![]() |
Section 8.2.1.1: |
![]() |
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 abstract class models the concept of an object to which no semantics is attached, other than bit-pattern equality. Features are specified to manipulate objects as a whole and to modify individual bits - as well as to convert to a numeric value.
Since the implementations of classes sub-typing from this abstraction necessarily use the pervasive AVAL constructor class, this reader routine must be defined - to indicate the number of contiguous bits of which an object of the class consists.
This feature provides an 'empty' object of asize bits all of which have the value clearbit. Where an object with all bits set is desired then this feature and the bit_invert one defined below could be used.
null | : SAME |
Since this is a creation operation the pre-condition is vacuously true.
This feature returns an object all of the bits of which have the value clearbit.
This feature is a potentially narrowing operation in which only the asize bits with the lowest indices in the sequence are placed into the value returned. The bit-pattern is identical to the bit-pattern in self for those eight bits.
Since the definition of this feature deliberately limits the range of the result, the pre-condition is vacuously true.
This feature returns the octet which contains the eight bits of self with the indices 0 to 7.
This feature may be either narrowing or widening, unused bits being ignored if narrowing and additional bits being clearbit if widening.
Since the definition of this feature deliberately limits the range of the result, the pre-condition is vacuously true.
This feature returns the hextet object which contains the lowest sixteen bits of self - extended with clear bits if self does not contain sixteen bits - with the indices 0 to 15.
This feature may be either narrowing or widening, unused bits being ignored if narrowing and additional bits being clearbit if widening.
Since the definition of this feature deliberately limits the range of the result, the pre-condition is vacuously true.
This feature returns the thirty-two bit wide object which contains the lowest thirty-two bits of self - extended with clear bits if self does not contain thirty-two bits - with the indices 0 to 31.
This conversion routine to a cardinal number takes the number of bits required to form a cardinal number (or all bits if less than that number of bits) and returns the number formed.
Since the definition of this feature deliberately limits the range of the result, the pre-condition is vacuously true.
Note that the value num_bits is that value defined by the implementation in accordance with Section 4.2 of this specification.
This feature returns the cardinal number formed by taking the bit-pattern of self in the lowest indexed bit positions in the result extended with clear bits to make up the number of bits required in a cardinal number.
This conversion routine to a character uses up to 31 bits from self (see ISO/IEC 10646-1:2000 referred to in Section 2 for the rationale behind this).
Note that the definition of the class UNICODE gives asize in terms of octets - as per the international standard.
This feature returns the bit-pattern of self as an object of type CHAR with which, however, no particular culture-dependent semantics are associated.
This conversion routine to an integer number takes the number of bits required to form a signed integer number (or all bits if less than that number of bits) and returns the number formed.
Since the definition of this feature deliberately limits the range of the result, the pre-condition is vacuously true.
Note that the value num_bits is that value defined by the implementation in accordance with Section 4.2 of this specification.
This feature returns a signed integer number formed by taking the bit-pattern of self in the lowest indexed bit positions in the result extended with clear bits to make up the number of bits required in an integer number.
Since there is no iterator over individual bits, this routine provides the facility for obtaining individual bit values.
In the following it should be remembered that Sather indices start at zero while indices for vdm sequences start at one.
This feature returns the value of the bit indexed by the given parameter.
Since there is no iterator over individual bits, this routine provides the facility for setting individual bit values.
In the following it should be remembered that Sather indices start at zero while indices for vdm sequences start at one.
This feature returns a new object containing the same bit-pattern as self except for the one indexed by the first argument which has been set to val.
This is an indexed version of the similarly named predicate in the pervasive class BIT, returning true if the relevant bit is set.
This predicate returns true if and only if the indexed bit of self has the value setbit and vice versa.
This is an indexed version of the similarly named predicate in the pervasive class BIT, returning true if the relevant bit is clear.
This predicate returns true if and only if the indexed bit of self has the value clearbit and vice versa.
This feature inverts all of the bits of self, setbits becoming clearbits and vice versa.
bit_invert | : SAME |
Since the domain of the argument and the domain of the result are identical, the pre-condition is vacuously true.
This feature returns the result of setting each bit of self which has the value setbit to clearbit and each bit of self which has the value clearbit to setbit.
This feature is the classic bit manipulation operation in which each result bit is set only if the corresponding bits of both self and other are set.
bit_and | ( |
other : SAME | |
) : SAME |
Since the range of each individual bit result and the domain of the arguments are the same, the pre-condition is vacuously true.
This feature returns the result of applying the logical and operation to each individual bit of self and the corresponding bit of other. If both corresponding bits have the value setbit then the corresponding bit of the result will be setbit, otherwise clearbit.
This feature is the classic bit manipulation operation in which each result bit is set if either of the corresponding bits of self and other are set.
bit_or | ( |
other : SAME | |
) : SAME |
Since the range of each individual bit result and the domain of the arguments are the same, the pre-condition is vacuously true.
This feature returns the result of applying the logical or operation to each individual bit of self and the corresponding bit of other. If either corresponding bits have the value setbit then the corresponding bit of the result will be setbit, otherwise clearbit.
This feature is the classic bit manipulation operation in which each result bit is set only if the corresponding bit of self and other have different values.
bit_xor | ( |
other : SAME | |
) : SAME |
Since the range of each individual bit result and the domain of the arguments are the same, the pre-condition is vacuously true.
This feature returns the result of applying the logical xor operation to each individual bit of self and the corresponding bit of other. If both corresponding bits have different values then the corresponding bit of the result will be setbit, otherwise clearbit.
This feature is a 'logical' left shift of the bits in self.
This feature returns the object which results from shifting the bit-pattern of self left (towards higher indices) by the number of places indicated, filling vacated positions by the value clearbit.
This feature is a 'logical' right shift of the bits in self.
This feature returns the object which results from shifting the bit-pattern of self right (towards lower indices) by the number of places indicated, filling vacated positions by the value clearbit.
This feature returns the index of the highest bit of self which has the given value (either setbit or clearbit).
Since the domain of the result is greater than the domain of indices of self the pre-condition is vacuously true.
This feature returns the index of the highest bit which has the value given by the argument - or CARD::maxval if no bit has that value.
This feature returns the index of the highest bit of self which has the value setbit.
Note that the name here has been changed since name overloading is not possible in vdm.
Since the domain of the result is greater than the domain of indices of self, the pre-condition is vacuously true.
This feature returns the index of the highest bit which has the value setbit - or CARD::maxval if no bit is set.
This feature returns the index of the lowest bit of self which has the given value (either setbit or clearbit).
Since the domain of the result is greater than the domain of indices of self, the pre-condition is vacuously true.
This feature returns the index of the lowest bit which has the value given by the argument - or CARD::maxval if no bit has that value.
This feature returns the index of the lowest bit of self which has the value setbit.
Note that the name here has been changed since name overloading is not possible in vdm.
Since the domain of the result is greater than the domain of indices of self, the pre-condition is vacuously true.
This feature returns the index of the lowest bit which has the value setbit - or CARD::maxval if no bit is set.
This is the first of two features of this name which return a text string representation of the bit-pattern as a sequence of hexa-decimal digits.
Since the domain of self is smaller than the domain for the result and the lib argument is not an optional type, the pre-condition is vacuously true.
This feature returns a hexadecimal text string representation of self using the given encoding and repertoire. Each character of the string is a hexadecimal digit for a corresponding sub-sequence of four bits from self. No prefix or suffix of any kind is to be included.
This second string representation feature uses the execution environment default culture, encoding and repertoire to determine the actual representation characters.
Note that the name of this formal signature has been changed since there is no name overloading in vdm.
Since the domain of self is smaller than the domain for the result and the lib argument is not an optional type, the pre-condition is vacuously true.
This feature returns a hexadecimal text string representation of self using the default encoding and repertoire. Each character of the string is a hexadecimal digit for a corresponding sub-sequence of four bits from self. No prefix or suffix of any kind is to be included.
![]() |
Language Index | ![]() |
Library Index | ![]() |
Binary Index |
Comments or enquiries should be made to
Keith
Hopper. Page last modified: Wednesday, 22 November 2000. |
![]() |