Home   :   Matrix Language   :   Primitive System Statements   :   Subtype Statements

Subtype Statements

 

Statements

 

Subtype

IntegerSubtype

BooleanSubtype

EnumerationSubtype

FixedSubtype

FloatSubtype

StringSubtype

 

 

General

 

A subtype statement declares a type that is based on a previously declared type. The range of values a subtype may take on is usually smaller than the type it is based on. The subtype takes on all the defined operations of the base type since the constraint applies only to the values.

 

The <<First>>, <<Last>> and <<Same>> directives specify that these values are identical to the corresponding value in the base type.

 

 

Subtype Statement

 

Type

BaseType

Integer

Temperature : -100 .. 10000

Subtype

IntegerSubtype

SubrangeInteger:Temperature

Vat_Temperature : -20 .. 100

SubrangeInteger:Temperature

Room_Temperature : 0 .. 60

 

The BaseType statement introduces the following subtype statements:

 

IntegerSubtype

BooleanSubtype

EnumerationSubtype

FixedSubtype

FloatSubtype

StringSubtype

 

The above types must appear in the order given above.

 

 

IntegerSubtype Statement

 

Subtype

IntegerSubtype

SubrangeInteger:Sys_Typ_Int_Fst_Lst

Sub_Fst_Neg : <<First>> ..    -9000

Sub_Pos_Lst :     +9000 .. <<Last>>

 

The IntegerSubtype statement introduces one or more SubrangeInteger statements.

 

 

BooleanSubtype Statement

 

Subtype

BooleanSubtype

SubrangeBoolean:Bol_Bool

Sub_Loop

Sub_Turn

 

The BooleanSubtype statement introduces one or more SubrangeBoolean statements.

 

 

EnumerationSubtype Statement

 

Subtype

EnumerationSubtype

SubrangeEnumeration:Enm_Day

Sub_Workday : MONDAY   .. FRIDAY

Sub_Weekend : SATURDAY .. SUNDAY

 

The EnumerationSubtype statement introduces one or more SubrangeEnumeration statements.

 

 

FixedSubtype Statement

 

Subtype

FixedSubtype

SubrangeFixed:Neg_Num

Sub_Num_Neg_Num : 0.001 : -10.0 .. 1.0

 

The FixedSubtype statement introduces one or more SubrangeFixed statements.

 

 

FloatSubtype Statement

 

Subtype

FloatSubtype

SubrangeFloat:Sme_Fst_Lst

Sub_Sme_Fst_Lst : <<Same>> : <<First>> .. <<Last>>

 

The FloatSubtype statement introduces one or more SubrangeFloat statements.

 

 

StringSubtype Statement

 

Subtype

StringSubtype

SubrangeString:Str_Sme

Sub_Sme : <<Same>>

Sub_Num :      100

 

The StringSubtype statement introduces one or more SubrangeString statements.

Copyright 2017 Dark Matter Systems Ltd. All Rights Reserved.