135
ThecomparisonoftwoP-sequencescanbeperformedpurelybyexaminingtheaddresses
theycontain.Sincesegmentsrepresentcontiguousportionsoftheaddressspace,thecom-
parisonprocessneedonlyexaminetheinitialaddressesoftherelevantsegments.Theproc-
essmustexamineeverysegmentthatappearsineitheroftheversions.
Thesimplestmethodofcomparisonisfirsttogeneratealistofallthesegmentsinoneof
thedocuments,intheorderthattheyoccur.Thepathportionsoftheaddressesofeachof
thesesegmentsmustbenormalizedforcomparison,sothatcorrespondingaddresseswillbe
equal.Pathsthatconsistonlyofinsertionsremainintact,becausedatathatissharedbe-
tweensequencesshouldcorrespond.Pathswithinitialmoveoperationsneedthemremoved
fromthepath,sincedatacorrespondsregardlessofwhatmoveoperationsmayhaveaffected
it.Becausecopyoperationsshouldonlycountasamatchwhentheyareidenticallypresent
inbothsequences,copyoperationsshouldnotberemovedfrompaths.Furthermore,move
operationsinthesourceofcopyoperationsshouldalsobepreserved;theycorrespondto
movesthatwereexecutedintheoriginofthecopy,andthatalreadymatchinthatcontext.
Anyaddressesthatareequalaftertheremovalofinitialmoveoperationsrepresentle-
gitimatecorrespondencesbetweenthetwoversions.Anyaddressespresentinoneversion
butnottheotherrepresentdeleteddata.Whilethisbasicsetofcorrespondencesisade-
quate,anapplicationmightwellprefertosorttheaddressrangesbypositionofoccurrence
inoneofthesequencesandtomergepairsthatareadjacentinbothorders,soastohave
correspondencesofmaximumlength.
6.8 Summary
Thischapterhasreviewedthesimplerchange-orientedsystemVTML2.0,anextensionof
jointworkundertakenwithFabioVitali(VitaliandDurand1995).CreatingaVTMLimple-
mentationhasseveralissuessimilartothoseinvolvedinaPalimpsestimplementation.The
managementofafragmentedsequencewithaglobalorderingisthemostsignificantsimi-
136
larity.IthenpresentedalgorithmicissuesinimplementingPalimpsest,withaneyetothe
bestpossibleasymptoticcomplexity.
Itisnotclearthattheheavyweightapproachtoimplementationrepresentedbythealgo-
rithmsinthischapterisneededforpracticaluse.Formanyapplications,especiallytexted-
iting,theneedtoproduceawholedocumentinminimaltimeisrare.Themainrequirement
istorefillscreenbuffersofmoderatesizequickly,andtosupportoccasionalrandomaccess.
Furthermore,mosteditingapplicationsinvolvetheincrementaladditionofsmallchanges,
andtheycanuselocalinteractionbufferstosupportdisplayandediting,ratherthanusing
themorecomplexpersistentstoreforinteractiveoperations.
Previous Page Next Page