66
thatoptionisnotnecessarilypractical,andinanycase,formostoff-lineeditingsituations
thevariationinmergeeffectsisunlikelytobefunctional.Forexample,considertwocol-
laboratorsmergingchangesseparatelypreparedoveraweekofdisconnectedoperation:the
precisetimeaneditwascreatedisalmostsuretobeirrelevant.
Asecondmethodissimplytoorderthechangesinsomepurelyarbitraryway.Lexico-
graphicallyorderingthechangesbasedonsomewell-knownrepresentationprovidesasim-
ple,easilydistributedwaytodeterminetheorderingoftwochanges.
Whilebothoftheforegoingarepossible,andhavetheirpotentialadvantages,wewillbe
choosingadifferentordering,basedonthestructureofthesequenceinquestion.Wewill
orderchangeswithrespecttoeachotherbasedontheirpositionwithinthesequenceitself.
Thekeyistoconsidertheinteractionofmoveoperationsthatoverlap.Inthecasethattwo
movesourceregionsintersect,butneitheriscompletelycontainedintheother,anyorder-
ingisasgoodasanyother.However,ifonesourceregioniscompletelycontainedinthe
other,thentheinnerregionshouldhavepriority.Thisisimportant,becausethecontaining
regionwouldconvertmoveofthecontainedregionintoaNOPbyclaimingallofitscontent.
Thebestsolutionisonewhere“smaller”operationstakepriorityandcanbefreelycombined
withlargerones.
3.3.4 Globalconflicts
Theglobalconflictsarethosethatinvolvecyclicrelationshipsbetweentheregionsofef-
fectofasetofchanges,sothataconflictexistsonlywhentheentiresetofchangesiscon-
sidered,buttheremovalofevenoneoftheconstituentchangeswouldeliminatethecon-
flict,bybreakingthecycle.Itissimplesttoconsiderthedegeneratecase,asinglechange
(eitheracopyoradelete)whosedestinationregionisinsideitssourceregion.(SeeFigure).
Inthecaseofacopy,wegetaninfinitedocumentifweattempttohonorthegeneralpolicy
ofhavingthesourceregionreflectallupdateswithinit.Inthecaseofamove,weendup
67
withadeletion,asthechange,liketheOurobouros,swallowsitsowntailanddisappears
(deleting,dutifully,theinfiniteregioninquestion).
Thisproblemcannotbesolvedbysimplyrulingoutself-reference,sinceacopyordelete
cyclecanhaveanynumberoflinks.Checkingalargesetofchangesforsuchcyclesisa
ratherdifficulttaskatmergetime.Furthermore,theindexingrequiredtomaketherelevant
relationshipsexplicitisnotusefulforanyothertaskthanpreventingthissortofconflict.
Thegeographicalorderprincipleallowsanelegantsolutiontotheproblem.Ifeverypoint
referredtobyeachchangeislinearlyordered,thenthecycleproblemcanbesolvedwithout
attemptingtoperformglobalcycledetectiononalargesetofchanges
6
.Conceptually,the
statedescribedbyasetofchangescanbefoundbysimplyscanningallpossibleaddressesin
thedocumentfromlefttoright(leasttogreatest),applyingeachchangeassoonasitisen-
countered.Thisgivesprioritytothechangewiththeleftmostaddress.Aliteralscanofall
possibleaddresseswouldbeveryinefficient,sincetherecanbeaverylargenumberofthem,
butitispossibletoimplementthisrulewithoutsuchaliteralscan.Anynumberofother
priorityrulescouldbedevisedonsimilarstructuralprinciples:theadvantageofthisoneis
thataleft-rightscanenumeratingsomenumberofelementsofasequenceisinfactacom-
monoperationineditingscenarios:suchascanmusttakeplacewheneveradisplaybuffer
needstobefilledorrefreshed.Thisrulealsoworkswellinadistributedenvironmentbe-
causeitdoesnotrequireanyinformationotherthanthechangesthemselves.

6
Althoughcycle-detectionisastandardproblemforwhichgoodalgorithmsarewellknown,the
graphwearerequiredtocheckisnotexplicitlyrepresentedinaconvenientway.Someformofindex
wouldberequiredtoefficientlydeterminewhatchangesare“connected”byhavingthedestination
pointofonechangeinthesourceregionofanotherchange.Sincethischeckwouldhavetobeper-
formedoneveryadditionofanewchangetoasequence,itcouldquicklybecomeexpensiveevenwith
afastincrementalalgorithmfordeterminingtheseconnections.
Previous Page Next Page