+
Point of view
All features
class BIT_STRING
Summary
Long and very long bit sequences. An INTEGER index can be used to access each bit of the sequence. The leftmost bit has index 1 and the rightmost bit has index count.
For short bit sequences (less or equal to 32 or 64), also consider to use basic INTEGER_N type.
Direct parents
Inherit list: TRAVERSABLE
Insert list: PLATFORM
Class invariant
Overview
Creation features
{ANY}
  • make (n: INTEGER_32)
    Make bit sequence of n bits.
  • from_string (model: STRING)
    Create or set Current using model which is supposed to be a sequence of mixed 0 or 1 characters.
Features
{}
{BIT_STRING}
{ANY}
Rotating and shifting:
{ANY}
Bitwise Logical Operators:
{ANY}
  • infix "and" (other: BIT_STRING): BIT_STRING
    Bitwise and of Current with other
  • infix "implies" (other: BIT_STRING): BIT_STRING
    Bitwise implication of Current with other
  • prefix "not": BIT_STRING
    Bitwise not of Current.
  • infix "or" (other: BIT_STRING): BIT_STRING
    Bitwise or of Current with other.
  • infix "xor" (other: BIT_STRING): BIT_STRING
    Bitwise xor of Current with other
  • and_mask (other: BIT_STRING)
    Apply bitwise and mask of other onto Current.
  • implies_mask (other: BIT_STRING)
    Apply bitwise implies mask of other.
  • or_mask (other: BIT_STRING)
    Apply bitwise or mask of other onto Current.
  • xor_mask (other: BIT_STRING)
    Apply bitwise xor mask of other onto Current
  • invert
    Invert Current bit-per-bit.
Conversions:
{ANY}
Others:
{ANY}
Other features:
{ANY}
{}
{ANY}
Other features:
{ANY}
Agent-based features:
{ANY}
{ANY}
{}
Agent-based features:
{ANY}
{}
Maximum:
{}
Minimum:
{}
Bits:
{}
word_size: INTEGER_8
is 32
constant attribute
{}
size of words in storage
word_limit: INTEGER_8
is 31
constant attribute
{}
word_size - 1
writable attribute
The storage area.
count: INTEGER_32
writable attribute
{ANY}
Number of bits in the sequence.
lower: INTEGER_32
is 1
constant attribute
{ANY}
Minimum index.
upper: INTEGER_32
effective function
{ANY}
Maximum index.
is_empty: BOOLEAN
effective function
{ANY}
Is the hoard empty ?
See also count.
make (n: INTEGER_32)
effective procedure
{ANY}
Make bit sequence of n bits.
from_string (model: STRING)
effective procedure
{ANY}
Create or set Current using model which is supposed to be a sequence of mixed 0 or 1 characters.
valid_index (idx: INTEGER_32): BOOLEAN
effective function
{ANY}
True when index is valid (ie. inside actual bounds of the bit sequence).
item (idx: INTEGER_32): BOOLEAN
effective function
{ANY}
True if idx-th bit is 1, False otherwise.
first: BOOLEAN
effective function
{ANY}
The very first item.
last: BOOLEAN
effective function
{ANY}
The last item.
put (value: BOOLEAN, idx: INTEGER_32)
effective procedure
{ANY}
Set bit idx to 1 if value is True, 0 otherwise.
put_1 (idx: INTEGER_32)
effective procedure
{ANY}
Set bit idx to 1.
put_0 (idx: INTEGER_32)
effective procedure
{ANY}
Set bit idx to 0.
shift_by (n: INTEGER_32)
effective procedure
{ANY}
Shift n-bits.
shift_left_by (n: INTEGER_32)
effective procedure
{ANY}
Shift left by n bits.
shift_right_by (n: INTEGER_32)
effective procedure
{ANY}
Shift right by n bits.
rotate_by (n: INTEGER_32)
effective procedure
{ANY}
Rotate by n bits.
rotate_left_by (n: INTEGER_32)
effective procedure
{ANY}
Rotate left by n bits.
rotate_right_by (n: INTEGER_32)
effective procedure
{ANY}
Rotate right by n bits.
infix "^" (s: INTEGER_32): BIT_STRING
effective function
{ANY}
Sequence shifted by s positions (positive s shifts right, negative left; bits falling off the sequence's bounds are lost).
infix "|>>" (s: INTEGER_32): BIT_STRING
effective function
{ANY}
Sequence shifted right by s positions.
infix "|<<" (s: INTEGER_32): BIT_STRING
effective function
{ANY}
Sequence shifted left by s positions.
infix "#" (s: INTEGER_32): BIT_STRING
effective function
{ANY}
Sequence rotated by s positions (positive right, negative left).
infix "#>>" (s: INTEGER_32): BIT_STRING
effective function
{ANY}
Sequence rotated by s positions right.
infix "#<<" (s: INTEGER_32): BIT_STRING
effective function
{ANY}
Sequence rotated by s positions left.
infix "and" (other: BIT_STRING): BIT_STRING
effective function
{ANY}
Bitwise and of Current with other
infix "implies" (other: BIT_STRING): BIT_STRING
effective function
{ANY}
Bitwise implication of Current with other
prefix "not": BIT_STRING
effective function
{ANY}
Bitwise not of Current.
infix "or" (other: BIT_STRING): BIT_STRING
effective function
{ANY}
Bitwise or of Current with other.
infix "xor" (other: BIT_STRING): BIT_STRING
effective function
{ANY}
Bitwise xor of Current with other
and_mask (other: BIT_STRING)
effective procedure
{ANY}
Apply bitwise and mask of other onto Current.
implies_mask (other: BIT_STRING)
effective procedure
{ANY}
Apply bitwise implies mask of other.
or_mask (other: BIT_STRING)
effective procedure
{ANY}
Apply bitwise or mask of other onto Current.
xor_mask (other: BIT_STRING)
effective procedure
{ANY}
Apply bitwise xor mask of other onto Current
invert
effective procedure
{ANY}
Invert Current bit-per-bit.
to_string: STRING
effective function
{ANY}
String representation of bit sequence.
to_integer: INTEGER_32
effective function
{ANY}
The corresponding INTEGER value when count <= Integer_bits. No sign-extension when count < Integer_bits.
all_cleared: BOOLEAN
effective function
{ANY}
Are all bits set to 0?
all_default: BOOLEAN
effective function
{ANY}
Are all bits set to 0?
clear_all
effective procedure
{ANY}
Set all bits to 0
all_set: BOOLEAN
effective function
{ANY}
Are all bits set to 1?
set_all
effective procedure
{ANY}
Set all bits to 1
is_equal (other: BIT_STRING): BOOLEAN
effective function
{ANY}
Is other attached to an object considered equal to current object?
copy (other: BIT_STRING)
effective procedure
{ANY}
Update current object using fields of object attached to other, so as to yield equal objects.
out_in_tagged_out_memory
effective procedure
{ANY}
Append terse printable representation of current object in tagged_out_memory
append_in (str: STRING)
effective procedure
{ANY}
Append in str a viewable representation of Current.
set_from_string (model: STRING, offset: INTEGER_32)
effective procedure
{ANY}
Use the whole contents of model to reset range offset ..
new_iterator: ITERATOR[BOOLEAN]
effective function
{ANY}
basic_rotate_right (n: INTEGER_32)
effective procedure
{}
Rotate right by n bits.
enumerate: ENUMERATE[E_]
effective function
{ANY}
get_new_iterator: ITERATOR[E_]
frozen
effective function
{ANY}
for_each (action: PROCEDURE[TUPLE[TUPLE 1[E_]]])
effective procedure
{ANY}
Apply action to every item of Current.
for_all (test: FUNCTION[TUPLE[TUPLE 1[E_]]]): BOOLEAN
effective function
{ANY}
Do all items satisfy test?
exists (test: FUNCTION[TUPLE[TUPLE 1[E_]]]): BOOLEAN
effective function
{ANY}
Does at least one item satisfy test?
aggregate (action: FUNCTION[TUPLE[TUPLE 2[E_, E_], E_]], initial: E_): E_
effective function
{ANY}
Aggregate all the elements starting from the initial value.
generation: INTEGER_32
writable attribute
{ANY}
next_generation
effective procedure
{}
do_all (action: ROUTINE[TUPLE[TUPLE 1[E_]]])
frozen
effective procedure
{ANY}
Apply action to every item of Current.
_inline_agent1 (a: ROUTINE[TUPLE[TUPLE 1[E_]]], e: E_)
frozen
effective procedure
{}
Maximum_character_code: INTEGER_16
{}
Largest supported code for CHARACTER values.
Maximum_integer_8: INTEGER_8
is 127
constant attribute
{}
Largest supported value of type INTEGER_8.
Maximum_integer_16: INTEGER_16
is 32767
constant attribute
{}
Largest supported value of type INTEGER_16.
Maximum_integer: INTEGER_32
is 2147483647
constant attribute
{}
Largest supported value of type INTEGER/INTEGER_32.
Maximum_integer_32: INTEGER_32
is 2147483647
constant attribute
{}
Largest supported value of type INTEGER/INTEGER_32.
Maximum_integer_64: INTEGER_64
is 9223372036854775807
constant attribute
{}
Largest supported value of type INTEGER_64.
Maximum_real_32: REAL_32
is {REAL_32 3.4028234663852885981170418348451692544e+38}
constant attribute
{}
Largest non-special (no NaNs nor infinity) supported value of type REAL_32.
Maximum_real: REAL_64
{}
Largest non-special (no NaNs nor infinity) supported value of type REAL.
Maximum_real_64: REAL_64
{}
Largest non-special (no NaNs nor infinity) supported value of type REAL.
Maximum_real_80: REAL_EXTENDED
{}
Largest supported value of type REAL_80.
Minimum_character_code: INTEGER_16
{}
Smallest supported code for CHARACTER values.
Minimum_integer_8: INTEGER_8
is -128
constant attribute
{}
Smallest supported value of type INTEGER_8.
Minimum_integer_16: INTEGER_16
is -32768
constant attribute
{}
Smallest supported value of type INTEGER_16.
Minimum_integer: INTEGER_32
is -2147483648
constant attribute
{}
Smallest supported value of type INTEGER/INTEGER_32.
Minimum_integer_32: INTEGER_32
is -2147483648
constant attribute
{}
Smallest supported value of type INTEGER/INTEGER_32.
Minimum_integer_64: INTEGER_64
is -9223372036854775808
constant attribute
{}
Smallest supported value of type INTEGER_64.
Minimum_real_32: REAL_32
is {REAL_32 -3.40282346638528859811704183484516925440e+38}
constant attribute
{}
Smallest non-special (no NaNs nor infinity) supported value of type REAL_32.
Minimum_real: REAL_64
{}
Smallest non-special (no NaNs nor infinity) supported value of type REAL.
Minimum_real_64: REAL_64
{}
Smallest non-special (no NaNs nor infinity) supported value of type REAL.
Minimum_real_80: REAL_64
{}
Smallest supported value of type REAL_80.
Boolean_bits: INTEGER_32
{}
Number of bits in a value of type BOOLEAN.
Character_bits: INTEGER_32
{}
Number of bits in a value of type CHARACTER.
Integer_bits: INTEGER_32
{}
Number of bits in a value of type INTEGER.
Real_bits: INTEGER_32
is 64
constant attribute
{}
Number of bits in a value of type REAL.
Pointer_bits: INTEGER_32
{}
Number of bits in a value of type POINTER.