Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/docshare/cola/ColaInsertion.java45
1 files changed, 6 insertions, 39 deletions
diff --git a/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/docshare/cola/ColaInsertion.java b/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/docshare/cola/ColaInsertion.java
index 5dedd0e80..2806db55b 100644
--- a/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/docshare/cola/ColaInsertion.java
+++ b/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/docshare/cola/ColaInsertion.java
@@ -39,54 +39,21 @@ public class ColaInsertion implements TransformationStrategy {
ColaUpdateMessage remoteTransformedMsg = remoteIncomingMsg;
if (localAppliedMsg.isInsertion()) {
- // check for full on collision - this is comparable to equal
- // insertion
- // pos. with single chars
- if ((remoteTransformedMsg.getOffset() >= localAppliedMsg.getOffset()) && (remoteTransformedMsg.getOffset() < (localAppliedMsg.getOffset() + localAppliedMsg.getText().length()))) {
- // determine what to modify and how
+ if (remoteTransformedMsg.getOffset() < localAppliedMsg.getOffset()) {
+ //coopt(remote(low),local(high)) --> (remote(low),local(low + high))
+ localAppliedMsg.setOffset(localAppliedMsg.getOffset() + remoteTransformedMsg.getOffset());
+ } else if (remoteTransformedMsg.getOffset() == localAppliedMsg.getOffset()) {
if (localMsgHighPrio) {
-
- int localMsgEndIndex = localAppliedMsg.getOffset() + localAppliedMsg.getText().length();
- remoteTransformedMsg.setOffset(localMsgEndIndex);
-
+ remoteTransformedMsg.setOffset(remoteTransformedMsg.getOffset() + localAppliedMsg.getText().length());
} else {
- // localMsg if of lesser prio
- // update both operations accordingly
-
- remoteTransformedMsg.setOffset(localAppliedMsg.getOffset());
-
- // TODO is this necessary? I think so ...
- /*
- * appliedLocalMsg.setOffset(appliedLocalMsg.getOffset() +
- * transformedRemote.getText().length());
- */
+ localAppliedMsg.setOffset(localAppliedMsg.getOffset() + remoteTransformedMsg.getText().length());
}
-
- } else if (remoteTransformedMsg.getOffset() < localAppliedMsg.getOffset()) {
-
- /*
- * appliedLocalMsg.setOffset(appliedLocalMsg.getOffset() +
- * transformedRemote.getText().length());
- */
-
} else if (remoteTransformedMsg.getOffset() > localAppliedMsg.getOffset()) {
-
remoteTransformedMsg.setOffset(remoteTransformedMsg.getOffset() + localAppliedMsg.getText().length());
}
- } else if (localAppliedMsg.isDeletion()) {
- // TODO determine which cases are interesting to a remote insertion
- // when running into a local, already applied deletion:
- // the following seems to be the only case of relevance here
- if (localAppliedMsg.getOffset() < remoteTransformedMsg.getOffset()) {
- // move remote insertion to the left
- remoteTransformedMsg.setOffset(remoteTransformedMsg.getOffset() - localAppliedMsg.getLength());
- }
}
- remoteTransformedMsg.remoteOperationsCount += 1;
- localAppliedMsg.remoteOperationsCount += 1;
-
Trace.exiting(Activator.PLUGIN_ID, DocshareDebugOptions.METHODS_EXITING, this.getClass(), "getOperationalTransform", remoteTransformedMsg); //$NON-NLS-1$
return remoteTransformedMsg;
}

Back to the top