Skip to content

Operation Transform Concepts

Philip Peitsch edited this page Apr 27, 2015 · 1 revision

Goals

  • Reduce amount of repeated logic in OT matrix
  • AND, provide more structured approach to OT to minimise unnecessary variations
  • AND, make OTs easier to implement and review

Operation definitions

Name Modifies step count Has attached region Special cases
AddAnnotation insertSteps (+2) Sometimes (length !== undefined)
MergeParagraph removeStep (-1) Yes (source + dest p's)
MoveCursor No Sometimes (length > 0)
RemoveText removeSteps (-length) No * RemoveText can't span paragraph boundaries
SplitParagraph insertStep (+1) Yes (source p + split point) * MergeParagraph (source + destination positions are first step in respective paragraph)

Operation rules

  1. A single operation can only insert or remove steps at a single point in the document
  2. An operation can be described as an insert/remove THEN region apply

General cases

For ease of understanding, all cases are presented from the perspective of opA transforming opB. Each of these rules are presented as a general case, meaning that the rule applies, but may be extended by further, more specialised rules.

General case: step insert / remove

  1. WHEN opA doesn't modify step count, THEN do not transform opB
  2. WHEN opA inserts/removes one or more steps
  3. WHEN opA is before opB, THEN move opB start position
  4. WHEN opA is on opB start boundary, THEN ...
  5. WHEN opA is within opB, THEN ...
  6. WHEN opA is on opB end boundary, THEN ...
  7. WHEN opA is after opB, THEN do not transform opB