![]() |
Examples 8.2.2.1: |
![]() |
The features of the required library class BIT are used in individual examples. None of the examples given is a complete class nor necessarily a 'complete' method.
This feature would typically be used to import a bit value which has been stored in some file, for example. The use of the cardinal number is merely to provide a uniform code between files written by one program and read by another. The significance of the value 1 is merely as a 'code', thus -
will serve to produce a bit value for manipulation in the current program.
card This routine provides a reverse conversion facility from the creation one, thus -
new_code_val : CARD := single_bit.card
Note that if the above two examples were adjacent statements in some using class, then code_val and new_code_val are not necessarily the same value, since in creating the bit value a code value other than 1 produces a clearbit. The card routine produces 0 for a clearbit.
is_eq Assuming that the following statement has already been executed then the equality expression is true -
other_bit : BIT := single_bit ;
equals : BOOL := (other_bit = single_bit)
however, the following equality is indeterminate without knowing the value of code_val a priori
equals := (code_val = new_code_val)
set This feature returns true if and only if the bit is set, thus -
equals := single_bit.set = other_bit.set
will always make equals true.
clear This feature returns true if and only if the bit is clear, thus -
equals := single_bit.clear = other_bit.clear
will also make equals true.
![]() |
Specification Index | ![]() |
Language Index | ![]() |
Section 8 Index |
Comments
or enquiries should be made to Keith Hopper. Page last modified: Thursday, 16 March 2000. |
![]() |