10.6 Undefined Values, the OclVoid Type


10.6 Undefined Values, the OclVoid Type

Some expressions will, when evaluated, have an undefined value. For instance, typecasting with the oclAsType operation to a type that the object does not support, or getting an element from an empty collection, will result in an undefined value.

The undefined value is the only instance of the type OclVoid . The OclVoid type conforms to all types in the system. There is an explicit operation for testing if the value of an expression is undefined. The operation oclIsUndefined is an operation on OclAny (see Section 10.10) that results in true if its argument is undefined, and false otherwise .

In general, an expression for which one of the parts is undefined will itself be undefined. Note some important exceptions to this rule, however. First, there are the logical operators:

  • True or undefined = True

  • False and undefined = False

  • False implies undefined = True

The rules for or and and are valid irrespective of the order of the arguments and irrespective of whether the value of the other sub-expression is known or not. The if expression is another exception. It will be valid as long as the chosen branch is valid, irrespective of the value of the other branch.



Object Constraint Language, The. Getting Your Models Ready for MDA
The Object Constraint Language: Getting Your Models Ready for MDA (2nd Edition)
ISBN: 0321179366
EAN: 2147483647
Year: 2003
Pages: 137

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net