129
Aninteractiveeditingprocesscanprovideanaddressdirectly,alongwiththesegmentthe
operationisaffecting.Theapplicationwilloperateonthatsequence,declaringoperationsin
termsofoffsetsintheP-sequencerepresentingitscurrentstate.Ifthereisaninterfacebe-
tweentheapplicationandthePalimpseststore,itshouldmaintainanindexofthePalimp-
sestaddresses(andtheirassociatedsegments)inthecurrentP-sequence.Then,whenanew
operationneedstoinsertanewaddressintothesegmentlist,thecorrectsegmentisavail-
able,enablingtheinsertionandthecreationofanew,labeledaddressrecordasimplemat-
terofdirectlistinsertion.ThisstrategyavoidseventhecostofusingthefindSegment
function.
6.7.2 Sequencecontents
Besidestextsegments,thetextsegmentstorealsocontainsanumberofdifferentobjects
andtheiraddressrecords:insertionpointsformovesandcopies;move,copyanddeletion
rangeendpoints;insomesystems,perhapstheendpointsofhypertextlinkanchors.Inaddi-
tiontorepresentingtheaddressspace,traversalofthesegmentlistishowthecontentsofa
P-sequenceareenumerated.
WenowconsiderthesequentialenumerationofthecontentsofaP-sequencerepresented
byachangesetV.Thefollowingadditionaloperationswillbeusedtochecktheauxiliary
datastructuresassociatedwithV:
1. isDeleted(V,address)checkstheaddresstoseeifitisdeletedbyanyofthe
deletionchangesinV.Takestimelogarithmicinthenumberofdeletions.
2. findDeletionFor(V,address)returnsadeletioninVthatoverlapsthegiven
address,oroneofthedeletionsthatstartsattheleftmostaddresstotherightofthe
givenaddress.Takestimelogarithmicinthenumberofdeletions.
3. getMoveRegion(V,address,changeID)returnthelongesthigher-priority
moveoperationoverlappingthegivenpoints,ifany.IfthechangeIDisnull,any
130
moveoperationhashigherpriority—thisisthetypicalcasewhenwearenotinthe
courseofprocessingthedestinationofamove.
ThealgorithmforenumeratingthecontentsofaP-sequencestartingfromagivenaddress
isshowninFigure6.6.Anauxiliaryfunctionfortestingthetypeofanon-deleted,non-
movedsegmentappearsinFigure6.7.
Previous Page Next Page