BitVector.kl

Types

BitVector (struct)

The BitVector is a memory-efficient Boolean array, where each element uses a single bit.

注釈

Setting different bits in parallel might lead to unexpected results, in which case methods such as BitVector.atomicSet should be used.

/*
** Example: BitVector
*/

require Containers;
  
operator entry() {

      BitVector b;
      b.resize(4);
      b.set(0, true);
      b.set(1, false);
      b.set(2, false);
      b.set(3, true);
      report(b.getString());    
  
}

/*
** Output:

[1,0,0,1]

*/

Methods

  BitVector ( in BitVector other )
  BitVector ()
  atomicClear ! ( in UInt32 index )
  atomicSet ! ( in UInt32 index )
  atomicSet ! ( in UInt32 index, in Boolean value )
BitVectorIterator begin ? ()
  clear ! ( in UInt32 index )
  clearAll ! ()
BitVector clone ? ()
  copy ! ( in BitVector src )
Boolean get ? ( in UInt32 index )
Boolean getNext ? ( io BitVectorIterator iter )
String getString ? ()
Boolean getThenClear ! ( in UInt32 index )
Boolean getThenSet ! ( in UInt32 index )
Boolean getThenSet ! ( in UInt32 index, in Boolean value )
  resize ! ( in UInt32 size )
  set ! ( in UInt32 index )
  set ! ( in UInt32 index, in Boolean value )
  setAll ! ()
UInt32 size ? ()

Operators

BitVector = ( Param other )

LocalL256BitVector (struct)

Same as a BitVector, but the first 256 bits will not require memory allocation (local).

Methods

  LocalL256BitVector ( in LocalL256BitVector other )
  LocalL256BitVector ()
  atomicClear ! ( in UInt32 index )
  atomicSet ! ( in UInt32 index )
  atomicSet ! ( in UInt32 index, in Boolean value )
BitVectorIterator begin ? ()
  clear ! ( in UInt32 index )
  clearAll ! ()
LocalL256BitVector clone ? ()
  copy ! ( in LocalL256BitVector src )
Boolean get ? ( in UInt32 index )
Boolean getNext ? ( io BitVectorIterator iter )
String getString ? ()
Boolean getThenClear ! ( in UInt32 index )
Boolean getThenSet ! ( in UInt32 index )
Boolean getThenSet ! ( in UInt32 index, in Boolean value )
  resize ! ( in UInt32 size )
  set ! ( in UInt32 index )
  set ! ( in UInt32 index, in Boolean value )
  setAll ! ()
UInt32 size ? ()

BitVectorIterator (struct)

a helper structure to perform iteration on a BitVector

Members

Integer index