![]() |
Section 8.2.2.1: |
![]() |
This class is a slight enhancement of the pervasive class BIT which has no conversion facilities (see create and card below). It provides the binary digit object which is the fundamental component of all objects defined in a computer system. The two possible values are setbit and clearbit.
NOTES | 1. The corresponding pervasive class has no inheritance - because it is pervasive! |
2. This class is defined in such a way that an implementation is not required to specify in what way the object is implemented, nor, indeed, to specify that it will always have the same implementation representation. Any use which attempts to rely on some particular representation is erroneous. |
The following feature is required to be implemented for this class in accordance with the specification given in the abstract class $IS_EQ :-
This creation routine returns a new binary digit. An implementation is free to implement this in any way appropriate provided only that the semantics specified here are implemented correctly.
create(val : CARD) res : BIT
The domain of the argument is narrowed to two - the value is either 1 or 'some other numeric value'. Since this is the same size as the domain of BIT the pre-condition is vacuously true.
This creation routine converts the given argument from a numeric value to a bit value. If the argument numeric value is 1 then the bit value is setbit, otherwise clearbit.
This conversion routine returns 1 if the bit is set, 0 if it is clear. Note that this does not constrain an implementation in the way in which it internally represents the two bit values.
Since the domain of the result type is larger than the domain of self, the pre-condition is vacuously true.
This routine returns the numeric value 1 if self is set, zero if self is clear.
This and the following clear feature are those defined in the pervasive definition in Section 7 of this specification. They are repeated here for convenience. This feature returns true only if self is set.
Since the domain of the result has the same number of values as the domain of self then this pre-condition is vacuously true.
This predicate returns true if and only if self has the value setbit, otherwise false.
This feature is repeated here from Section 7 for convenience. It returns true if self is clear.
Since the domain of the result has the same number of values as the domain of self then this pre-condition is vacuously true.
This predicate returns true if and only if self has the value clearbit, otherwise false.
![]() |
Language Index | ![]() |
Library Index | ![]() |
Binary Index |
Comments or enquiries should be made to
Keith
Hopper. Page last modified: Wednesday, 22 November 2000. |
![]() |