28.01.2015 Views

Hermes: A Tutorial and Reference Manual - Researcher - IBM

Hermes: A Tutorial and Reference Manual - Researcher - IBM

Hermes: A Tutorial and Reference Manual - Researcher - IBM

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

6.Determinethepostconditionsforeachpossibleoutcomeoftheoperation.Foreachoutcome,usetherulesgiveninthetabletodetermine<br />

exceptionoutcomeprovideditsoper<strong>and</strong>isakeyedtable. |forexample,itmaysaythattheoperationhasaDuplicateKey 10.TypestateChecking89 whichattributestoaddtoordropfromthetypestate. 7.Checkthatafteradding<strong>and</strong>droppingtheappropriateattributesthe 8.Wheneachtypestateiscomputed,propagatethattypestatetothe resultingtypestateisvalid.<br />

tions: NamedProgram:record(A:Charstring,B:Program); Let'sapplythesestepstoanexample.SupposeIhavethesetypedeniercionoperationstolowerthetypestatetothatmeettypestate.<br />

youhavejustcomputedforthispathtothatdestination.Insertco-<br />

destination.Ifthatdestinationalreadyhasatypestate,computethe<br />

ProgramRepository:tableofRffullgkeys(A); meet(asdenedabove)ofitsprevioustypestate<strong>and</strong>thetypestate<br />

init(R),init(P),init(P.A),init(P.B),checked(P.B)g.Supposethe oftypeProgramRepository.Supposethecurrenttypestateis:finit(I), therearethreerulesrelevanttotypestatechecking.Theseare:thepreconditionrules,thepostconditionrules,<strong>and</strong>theexceptionlist.Forinsert,<br />

statementbeingcheckedis: LookatthetableofoperationrulesinAppendixB.Aftertheclassrules, insertPintoR; NowsupposeIisoftypeinteger,PisoftypeNamedProgram<strong>and</strong>Ris<br />

thepreconditionrulesare (init(table),lowestelementstate(element,table),var(table), var(element),duplicatekey(table))<br />

attributesareforbidden.SectionB.4explainshowtoapplyeachpreconditionfunctiontodeterminetherequired<strong>and</strong>forbiddenattributes.<br />

attributesarerequired:finit(R),init(P),init(P.A),init(P.B)g.This attributeisforbidden:checked(P.B).Sincealltherequiredattributes init(P.B)g.AnyattributesofPorofitscomponentsotherthantheabove Ruleinit(table)saysthatthetableoper<strong>and</strong>mustbeinitialized.Rule SubstitutingPintothisformaltypestateyieldsfinit(P),init(P.A), lowestelementstate(element,table)saysthattheelementoper<strong>and</strong>must beinthelowesttypestateconsistentwiththeelementtypestateofthetable. isffullg,whichisanabbreviationoffinit(*),init(A),init(B)g. (Elementtypestateisdenedbelowinsection11.6.)Theelementtypestate Thersttwomembersofthelistaretypestatepreconditionfunctions.<br />

Asaresultofapplyingthepreconditionrules,itisdeterminedthatthese

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!