93
4.3.4 TheP-sequencecontentfunctionC
S
ThefinalcomponentoftheP-sequenceforaminimallyconsistentchangesequenceSis
thefunctionthatreturnsthecontentsofarangewithinit,giventheendpointsofthat
range.AsdiscussedinSection3.3,themainissueisdealingwiththerelativeorderingofthe
effectsofchangesincaseswheretheeffectofone(ormore)changescouldaffecttheresults
ofotherchanges.Wesawthatthereisnosinglegoodanswertosuchsituations,butthat
someformoforderneedstobeimposediftheresultsaretobesensible.Inparticular,ifthe
moveoperationistopreservetheinvariantthatmoveddataappearsexactlyonceinadocu-
ment,thensomeorderofeffectisrequired.Theexactorderingchosenisaparameterofthe
modelthatcanbeadjustedtomeettheneedsofaparticularimplementationorapplication.
Thesymbol<
chg willbeusedtodenotethisordering.Theraiseddotisusedforsequencecon-
catenation,sothata bdenotestheconcatenationofsequencesaandb.L representsthe
nullsequence.
ThefunctionC
S (a
1 ,a
2 )isdefinedintermsofafunctionC’
S (a
1 ,a
2 ,S’) whereS’ isasubset
ofScontainingchangesthatshouldcontributetothedeterminationofthecontentsofthe
rangefroma
1 …a
2 .S’ allowsC’ tobeusedrecursivelytodetermine,forexample,thecontents
ofthesourceofamovewithoutconsideringtheeffectofthatmoveonthesource(sincethe
effectwouldbetodeletetheentirerange).
Definition4.10:C
S (a
1 ,a
2 )isdefinedasC’(a
1 ,a
2 ,S).
AfewpredicateswillsimplifythedefinitionofthecontentsofaP-sequence.Deleted(a
1 ,
a
2 ,S)istrueifthedataintherangea
1 …a
2 isdeletedbyanyofthechangesinachangeset
S.Moved(a
1 , a
2 , S)determinesifthedataintherangea
1 …a
2 appearselsewherebecauseof
movesinS.RecessiveMoves(m,S)isthesetofallmovesinSwithaprioritylessthanor
equaltothatofm.
Definition4.11:Deleted(a
1 ,a
2 ,S)istrueiff$ c e S, c = D[a’
1 , a’
2 ]and
a’
1 £
SA a
1 <
SA a
2 £
SA a’
2 .
94
Definition4.12:Moved(a
1 ,a
2 , S)istrueiff$c e S, c =M[a’
1 , a’
2 ,d]and
a’
1 £
SA a
1 <
SA a
2 £
SA a’
2 .
Definition4.13:RecessiveMoves(m,S)is{c =M[a,b,c]e S| c <
chg morc = m}.
Definition4.14:ForaP-sequenceX
S ,andS’ ˝ S,C’(a
1 , a
2 , S’)isdefinedbythefollowing
cases,listedinorderofpriority:
1. Ifa
2 <
SA a
1 ,C’(a
1 ,a
2 , S’)isL.
2. IfDeleted(a
2 , a
2 ,S’),C’(a
1 ,a
2 , S’)isL.
3. IfI
X (a
1 ) + 1 I
X (a
2 ),C’(a
1 ,a
2 )isequaltoC’(a
1 , P
X (I
X (a
1 ) + 1), S’)C’(P
X (I
X (a
1 ) + 1),a
2 ,
S’).
4. Ifa
2 = (I,
i),andIistheIDofaninsertionI[s,d],wheres = v
1 v
n ,then
C’(a
1 , a
2 ) = v
i–1 .
5. Ifa
1 = (I
1 …I
n , i),a
2 = (I’
1 …I’
n , j),I
1 = I’
1 ,andChange(I
1 )isacopy,then
C’(a
1 , a
2 , S) = C’((I
2 …I
n , i), (I’
2 …I’
n , j), S’).
6. Ifa
1 = (I
1 …I
n , i),a
2 = (I’
1 …I’
n , j),I
1 = I’
1 ,Change(I
1 )isamove,then
C’(a
1 , a
2 , S’) = C’((I
2 …I
n , i), (I’
2 …I’
n , j), S’ RecessiveMoves(I
1 , S’)).
7. IfMoved(a
2 , a
2 ,S’),C’(a
1 ,a
2 , S’)isL.
8. OtherwiseC’(a
1 , a
2 , S’) = L.
Wecanseeafewthingsaboutthecontentsofasequenceandtheirrelationshiptothe
structureofaddresses.Allcontentsinasequenceoriginallycomefromsomeinsertionopera-
tion,andtheaddressesbetweenwhichcontentsoccurcontaintheIDoftheirinsertion.
Manypairsofaddressesexistbetweenwhichnodataoccurs.Wheneversomethingisin-
serted,whetherdirectlyorastheresultofamoveoracopy,newaddressesarecreatedbe-
foreandafterthenewdata.Whiletheaddressataninsertionpointisnolongeravailableas
thetargetforotherchanges(inordertopreserveminimalconsistency),anewinsertion
pointiscreatedimmediatelyafterit,immediatelyprecedingthenewmaterial.Similarly,a
Previous Page Next Page