The following features are supported:
Record types are managed via the {@link TypeManager}. To instantiate a RecordType use {@link TypeManager#newRecordType(QName)} TypeManager.newRecordType}. As all entities within this API,record types are dumb data objects.
A record type consists of:
Record types are versioned: upon each update, a new version of the record type is created. Record store a pointer to the particular version of a record type that was used when creating/updating a record type. The references to the supertype record types are also to specific versions.
A record type has two unique identifiers:
Implementation note: RecordType objects can be though of as defining a finite sequence of extensions from a base record variable: the non-record polymorphic records are: {NO_FIELDS | extensionFieldsMap1 | extensionFieldsMap2 | ... | extensionFieldsMapN} the record-polymorphic records are: r\lacksFields => {r | extensionFieldsMap1 | extensionFieldsMap2 | ... | extensionFieldsMapN} Where the extensionFieldsMaps are restricted by construction to having distinct domains (i.e. the fields don't overlap) and there are similar consistency constraints on the record variable r.
After type-checking however, we can reduce these representations to the simpler cannonical forms: {NO_FIELDS | hasFieldsMap} r\lacksFields => {r | hasFieldsMap}
This is similar to how TypeExpr values after type-checking are reduced to having no instantiated type variables (deep pruning). @author Bo Ilic
Note that a record type with more fields is a subtype of a record type with a subset of the fields. For example, {x = double, y = int} is a subtype of {x = double}. When a record of type {x = double, y = int} is converted to one of type {x = double}, the extra field is discarded. The converted record, therefore, will have exactly the fields in the type.
A consequence of this is that all record types are subtypes of the empty record type. Hence, to require that a typeable object be a record type without specifying what the fields are, use
typeable.setTypeAtMost(new RecordType(new String[0], new Type[0]));Note, however, that by itself this type constraint will not be useful because it does not, by itself, prevent the type from resolving to unknown (the unknown type is at the bottom of the type lattice, and hence satisfies this type constraint). @author Yuhong Xiong, Elaine Cheong and Steve Neuendorffer; contributor: J. S. Senecal @version $Id: RecordType.java,v 1.75 2007/12/07 06:31:50 cxh Exp $ @since Ptolemy II 3.0 @Pt.ProposedRating Red (neuendor) @Pt.AcceptedRating Red (cxh)
|
|
|
|
|
|
|
|