130
moveoperationhashigherpriority—thisisthetypicalcasewhenwearenotinthe
courseofprocessingthedestinationofamove.
ThealgorithmforenumeratingthecontentsofaP-sequencestartingfromagivenaddress
isshowninFigure6.6.Anauxiliaryfunctionfortestingthetypeofanon-deleted,non-
movedsegmentappearsinFigure6.7.
131
enumerateContents(version,address,enumerate)
/*afairamountofsetupforthemainenumerationloop*/
/*themovestacktracksthecurrentlyactivemoveoperation*/
ifaddress.path().length>1then
PutmoveIDsandendpointsofmovesourceranges
formovesinaddress.path()ontomc_stack.
Theymustbeenteredinreverseorder.Thismeansthat
address.path().head()shouldbetopofthestack.
else
mc_stack=empty
endif
cur_address=address
cur_seg=findSegment(version,address.path(),address.index())
cur_deletion=findDeletionFor(version,cur_address)
while(cur_seg!=null&&applicationstillwantsdata) then
ifcur_deletion.start()<cur_address)
cur_address=cur_deletion.end().next()
else
test_move=getMoveRegion(version,cur_address,
mc_stack.top().getID())
iftest_move!=nullthen
cur_address=test_move.end()
else
/*wearenowsurethatthedata(ifany)isOK.*/
/*wealwayshaveawholesegment,becauseboundaries
fordeletionsandmovessplitsegments*/
cur_address=process(cur_seg,mc_stack,enumerate,
version)
endif
endif
ifcur_address=mc_stack.top().sourceRegion().end()
cur_address=mc_stack.top().destAddress().next()
mc_stack.pop()
endif
cur_deletion=findDeletionFor(cur_address)
endwhile
F F F F iii ig g g gu u u ur r r re e e e 6666....6666:::: AAAAllllggggoooorrrriiiitttthhhhmmmm ffffoooorrrr eeeennnnuuuummmmeeeerrrraaaattttiiiinnnngggg tttthhhheeee ccccoooonnnntttteeeennnnttttssss ooooffff aaaa PPPP----sssseeeeqqqquuuueeeennnncccceeee
Thepseudo-codeinFigure6.6showsexactlyhowtheinformationaboutdeletedand
movedsubsequencescanbeusedtoskipoverportionsofthesequencethatarenotpartof
thecurrentversion.Oneaspectnotshownisthatthesegment.next()operationcouldbe
modifiedtotakeanargument,version,specifyingthechangesetbeingtraversed.This
Previous Page Next Page