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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

10211.4.ScalarOperations eration.Youcancopynominals<strong>and</strong>testthemforequality.Youcannot uesareequaliftheyarecopiesofthesamegeneratedvalue,otherwisethey areunequal.Anominaltypedenitioncreatesanewnominaldomain. performorderedcomparisonsorconversionstointegers.Twonominalval-<br />

anamedliteralwitheachvalue,e.g.'blue'.Thenamedliteralsofasingle enumerationtypedenitionmustbedistinct.Thisnamedliteralcanbe merationtypedenitiondenesanewenumerationdomain,<strong>and</strong>associates Example:::=nominal TransactionId:nominal; Anenumerationdomainconsistsofanitenumberofvalues.Anenu-<br />

type{construction<br />

usedinexpressionstogeneratethevalueitnames.Enumerationvaluesof course,thevalue'blue'inoneenumerationdomainhasnothingtodo withthevalue'blue'inadierentenumerationdomain,sinceonlyvalues thesametypeareequaliftheyareequaltothesamenamedliteral.Of ofthesametypecanbecompared. type{construction<br />

thekeywordorderedappearsinthedenition.Unorderedenumerations ::=[ordered]enumeration(<br />

supportcomparisonsonlyforequality<strong>and</strong>inequality,justlikenominals. Enumerationsareeitherorderedorunordered,dependingonwhether ::=variantofenumeration{type( )<br />

[case{declaration[,case{declaration]...] [named{literal[,named{literal]...]<br />

Orderedenumerationsalsosupporttheorderedcomparisons,=.Theyalsocanbeconvertedtointegers.Therstenumerationliteral Thefollowingaresomeexamples.<br />

theother\false".Abooleantypedenitionassociatesthetrue<strong>and</strong>false valueswithdistinctnamedliterals. thatcontainsallthecharactersoftheASCIIcharactersetinsortedorder. Aboole<strong>and</strong>omainconsistsoftwovalues,onerepresenting\true"<strong>and</strong> option:enumeration('present','absent'); color:enumeration('red','blue','yellow','green'); ThereisapredenedorderedenumerationtypecalledPredefined!Character quality:orderedenumeration('poor','fair','good','excellent'); type{construction ::=boolean(boolean{association)

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

Saved successfully!

Ooh no, something went wrong!