# Section 8.2.2.3:
HEXTET

###### immutable class HEXTET < $BIT_PATTERN

#### Formal Types

types
SAME = HEXTET ;
HEXTET = seq of BIT
inv oct ==
len oct = 16

This class is the primitive immutable class which has sixteen bits, but otherwise may have any meaning. Operations for creation, conversion and individual bit testing and manipulation are provided in addition to equality testing (which is solely a test of identical bit-patterns).

#### External specifications

The following feature is required to be implemented for this class in accordance with the specification given in $IS_EQ of which $BIT_PATTERN is a sub-type :-

- is_eq(other : SAME) : BOOL

The following features are required to be implemented for this class in accordance with the specifications given by inheritance in $STR of which $BIT_PATTERN is a sub-type :-

- str(lib : LIBCHARS) : STR
- str : STR

The following feature is required to be implemented for this class in accordance with the specification given in $HASH of which $BIT_PATTERN is a sub-type :-

- hash : CARD

The following features are required to be implemented for this class in accordance with the specifications given in $BINARY of which $BIT_PATTERN is a sub-type :-

- create(storage : BINSTR) : SAME
- build(cursor : BIN_CURSOR) : SAME
- read(cursor : BIN_CURSOR) : SAME
- binstr : BINSTR
- write(fyle : BIN_FILE)

The following features are required to be implemented for this class in accordance with the specifications given in the abstract class $BIT_PATTERN :-

- asize : CARD
- null : SAME
- octet : OCTET
- hextet : HEXTET
- quad : QUADBITS
- card : CARD
- char : CHAR
- int : INT
- bit(index : CARD) : BIT
- alter(index : CARD, val : BIT) : SAME
- set(index : CARD) : BOOL
- clear(index : CARD) : BOOL
- bit_invert : SAME
- bit_and(other : SAME) : SAME
- bit_or(other : SAME) : SAME
- bit_xor(other : SAME) : SAME
- left(places : CARD) : SAME
- right(places : CARD) : SAME
- highest(val : BIT) : CARD
- highest : CARD
- lowest(val : BIT) : CARD
- lowest : CARD
- hex_str(lib : LIBCHARS) : STR
- hex_str : STR

#### Hextet_Bits

This reader routine provides the same value as asize - for a hextet!

Hextet_Bits | : CARD

##### Formal Signature

Hextet_Bits() : res : CARD

##### Pre-condition

Since this is a reader routine, the pre-condition is vacuously true.

##### Post-condition

post (res = asize(self))

This reader routine returns the number of bits contained in a hextet (16!).

#### Hextet_Max

This reader routine returns the maximum unsigned value which can be represented in a hextet bit-pattern.

Hextet_Max | : CARD

##### Formal Signature

Hextet_Max() : res : CARD

##### Pre-condition

Since this is a reader routine, the pre-condition is vacuously true.

##### Post-condition

post (res = 2 ** asize(self) - 1)

This reader routine returns the maximum numeric value representable as an exact unsigned number in the hextet bit-pattern.

#### create

This creation feature returns a new hextet all the bits of which are clear (ie having the value clearbit).

create | : SAME

##### Formal Signature

create() res : SAME

##### Pre-condition

Because there are no arguments to this feature, the pre-condition is vacuously true.

##### Post-condition

post let resbits : seq of BIT be st resbits = res in
resbits = [clearbit, clearbit, clearbit, clearbit, clearbit, clearbit, clearbit, clearbit,
clearbit, clearbit, clearbit, clearbit, clearbit, clearbit, clearbit, clearbit]

This routine creates a new hextet value all the components of which are clear.

#### create

This second creation routine returns a new hextet in which the bit-pattern is the representation of val.

create | (
| val : CARD
| ) : SAME

##### Formal Signature

create2(val : CARD) res : SAME

##### Pre-condition

pre val <= Hextet_Max

##### Post-condition

post card(res) = val

This routine returns a new hextet which takes the value val as a bit-pattern.

#### create

This third creation routine returns a new hextet in which the bit-pattern is the representation of the character val in sixteen bits.

create | (
| val : CHAR
| ) : SAME

##### Formal Signature

create3(val : CHAR) res : SAME

##### Pre-condition

pre let extra = tl tl CHAR.binstr(val) in
forall idx in inds extra & extra(idx) = null

##### Post-condition

post char(res) = val

This routine returns a new hextet which takes the value val as a bit-pattern.

| Language Index |  | Library Index |  | Binary Index

Comments or enquiries should be made to Keith Hopper. Page last modified: Wednesday, 22 November 2000. |