2013年2月5日火曜日

データ型 - 部分型 - 値域

値域は、とりうる値の最小値および最大値を制限します。

型の記法
  値域   ::= 下端点 .. 上端点
  下端点 ::= 下端値 | 下端値 <
  上端点 ::= 上端値 | < 上端値
  下端値 ::= 値 | MIN
  上端値 ::= 値 | MAX

型の記法の例
IntegerType ::= INTEGER
0未満の整数
NegativeNumber ::= IntegerType ( MIN .. < 0 )

0以下の整数
NonPositiveNumber ::= IntegerType ( MIN .. 0 )

0より大きい整数
PositiveNumber ::= IntegerType ( 0 < .. MAX )

0以上の整数
NonNegativeNumber ::= IntegerType ( 0 .. MAX )

0 件のコメント:

コメントを投稿