Section 4.4 CSN rules for an enumeration definition


The rules defining an enumeration are similar to those for a class. As before, the explanation below is in CSN and is intended to serve as a template.

// The definition of an enumeration always begins with an open, angled bracket, // followed by the word Enumeration.

subclass: EnumerationName::Schema2

// A meaningul name for the enumeration is provided. With a user defined enumeration // that is followed by two colons and the name of the external schema to which the // enumeration belongs. As in the class definition, the enumeration name and // schema name begin with upper case letters and are followed by zero or more // characters which may be upper or lower case letters ,numeric digits or underscores (_).

values: descriptionA descriptionB descriptionN

// Any finite number of descriptions may be listed. Internally, SAIF assigns an integer // to each description, beginning with with 0 and incrementing by one. The integers then // for the above example are 0, 1 and 2. Normally these are not visible to the user and are // of no interest.

// In special cases, it may happen that a user wishes to assign his or her own integer values // to the desciptions in order to match some pre-existing specification. In this case after each // description a numerical value is given in parenthesis. The values clause in this situation is // as follows: // values: descriptionA (integerA) descriptionB (integerB) descriptionN (integerN) // A real example of this is shown later in this chapter

comments: Comments may be given explaining the values in the enumeration.

// Comments in an enumeration typically provide textual definitions of the values in // the enumeration. However, tables and graphics may also be included. (See also the discussion // on comments in the earlier section on class definitions.)

>

// The definition of an enumeration ends with a closing, angled bracket.


Links to the SAIF 3.1 Specification document and the complete SAIF class list