![]() |
Section 8.11.1.2: |
![]() |
This abstract class defines a state component which is a set of all instantiations of objects of any class sub-typing from this class in addition to the vdm model types used wherever this class name is used. Note that SAME has to be an instantiated class, not an abstract one.
NOTE | See the important note about vdm state in the notes on vdm-sl usage in this specification. |
This abstraction models an arbitrary bit set whose size in bits is known when implementation classes sub-typing from it are instantiated.
The purpose of this abstraction is to provide a facility for manipulating externally specified 'flag' or 'option' bits in some value read from or written to an operating system or hardware device.
The number of binary digits in such a set will in general not exceed the number of bits in a machine word. This feature, however, does not have any such restriction.
This feature provides the count of the number of binary digits (bits) which constitute the set.
Provided that there are no more bits in the set than will fit into a number-sized binary object, this feature provides a bit-pattern in which the bits of the set are in the least significant end of the resulting value, the remaining 'unused' bits being clearbit.
This feature returns the set in the lowest size bits of the result - other bits being clear.
This abstract class defines a state component which is a set of all instantiations of objects of any class sub-typing from this class in addition to the vdm model types used wherever this class name is used. Note that SAME has to be an instantiated class, not an abstract one.
NOTE | See the important note about vdm state in the notes on vdm-sl usage in this specification. |
This abstraction models arbitrary bit sets whose size (in bits) is determined by the element type ELEM which must be an enumeration.
This is the sole creation routine; it returns the empty set.
empty | : T |
This is a creation routine without arguments and the pre-condition is therefore vacuously true.
This feature returns the empty set - not void.
This predicate returns true if no elements are contained in the set - ie it is the mathematical set written in vdm-sl as '{}'.
is_empty | : T |
This is a predicate with self as the only (non-optional) argument; the pre-condition is therefore vacuously true.
This feature returns true if and only if self is the empty set.
The remaining features of this abstraction are the logical operations on sets. Except for the set membership operation (contains) they are specified in terms of the named operations which permit the use of infix notation in accordance with the following set operation equivalence -
Name | Operand | Function | Name | Operand | Function |
plus | ELEM | union | plus | T | union |
minus | T | difference | times | T | intersection |
div | T | sym difference | is_eq | T | equality |
is_leq | T | simple sub-set | is_lt | T | proper sub-set |
This variant of the plus feature is required as a useful convenience to include the argument in the set.
plus | ( |
elem : ELEM | |
) : T |
There are no constraints on either the set or the element values for this operation, thus -
This feature includes the argument element into the set returned. It is needed in the absence of any other create operation but empty.
This variant of the plus feature provides the mathematical set union operation.
plus | ( |
other : T | |
) : T |
There are no constraints on either set for this operation, thus -
This feature returns the set which is the set union of the argument and self.
This feature provides the mathematical set difference operation.
minus | ( |
other : T | |
) : T |
There are no constraints on either set for this operation, thus -
This feature returns the set which is the set difference of the argument and self.
This feature provides the mathematical set intersection operation.
times | ( |
other : T | |
) : T |
There are no constraints on either set for this operation, thus -
This feature returns the set which is the set intersection of the argument and self.
This feature provides the mathematical set symmetric difference operation.
div | ( |
other : T | |
) : T |
There are no constraints on either set for this operation, thus -
This feature returns the set which is the set symmetric difference of the argument and self.
This predicate provides the mathematical set membership operation.
There are no constraints on either the set or the element values for this operation, thus -
This feature returns true if and only if elem is in the set.
This predicate provides the mathematical set equality relation.
There are no constraints on either the set or the element values for this operation, thus -
This feature returns true if and only if the two sets contain the same elements and no others.
This predicate provides the mathematical subset relation.
There are no constraints on either the set or the element values for this operation, thus -
This feature returns true if and only if self is a simple sub-set of other.
This predicate provides the mathematical proper subset relation.
There are no constraints on either the set or the element values for this operation, thus -
This feature returns true if and only if self is a proper sub-set of other.
![]() |
Language Index | ![]() |
Library Index | ![]() |
Non-numeric Index |
Comments or enquiries should be made to
Keith
Hopper. Page last modified: Wednesday, 22 November 2000. |
![]() |