Integrations (PTC products, 3rd party products and code) > Code integration (Ada, ARINC 653, C, C#, C++, IDL, Java, SQL and VB) > Ada Code > Generating Ada code > Modeling Ada code in Modeler > Modeling variant record types in Modeler (Ada code)
  
Modeling variant record types in Modeler (Ada code)
You model a variant record type in Modeler through a Class or Data Type and its Attributes:
The Class or Data Type is stereotyped by the «Ada Variant Record» stereotype.
The discriminant is modeled through an Attribute stereotyped by the «Ada Discriminant» stereotype.
In a single discriminant variant record, each field of the variant record type is modeled through an Attribute. Variant fields are stereotyped by the «Ada Variant» stereotype, with the Ada Case tag definition recording the associated case text.
In a multi-discriminant variant record, the text of the case block is specified through the tagged value of the Ada Case Block tag definition, which is applied by the «Ada Variant Record» stereotype.
* 
If a case has multiple variant fields, the Attributes that model those fields must be adjacent in the owning Class or Data Type.
For example (single discriminant variant record):
To model a variant record type in Modeler:
1. If you have not done so already, add the Ada Profile package to the Model. How?
2. Create a Class or Data Type to represent the variant record type:
a. In the required Package, create a Class or Data Type.
b. Name the Class or Data Type to that of the variant record type.
c. Apply the «Ada Variant Record» stereotype to the Class or Data Type. How?
3. Create a Type Definition for the discriminant's type:
a. In the required Package, create a Type Definition.
b. If the Type Definition is an Enumeration, create an Enumeration Literal for each of the discriminant's cases.
4. Create an Attribute to represent the discriminant:
a. Create a child Attribute of the Class or Data Type.
b. Name the Attribute to that of the discriminant.
c. Apply the «Ada Discriminant» stereotype to the Attribute. How?
d. Set the Attribute's Type to the Type Definition created in step 3.
5. If the variant record has only one discriminant, for each variant field in the variant record type:
a. Create a child Attribute of the Class or Data Type.
b. Name the Attribute to that of the field.
c. Apply the «Ada Variant» stereotype to the Attribute. How?
d. Set the tagged value of the Ada Case tag definition to the associated case text, that is, the same as the appropriate Enumeration Literal created in step 3.b.
e. Set the Attribute's Type as appropriate.
f. If a case has multiple variant fields, in the owning Class or Data Type order the Attributes that model those fields so that they are adjacent. Tell me more...
If the variant record has multiple discriminants:
Type the text of the case block in the tagged value of the Ada Case Block tag definition, which is applied through the «Ada Variant Record» stereotype.
6. For each field that is not a variant in the variant record type:
a. Create a child Attribute of the Class or Data Type.
b. Name the Attribute to that of the field.
c. Set the Attribute's Type as appropriate.