eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'BooleanArray':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: BooleanArray


Inheritance:

   Object
   |
   +--Collection
      |
      +--SequenceableCollection
         |
         +--ArrayedCollection
            |
            +--BitArray
               |
               +--BooleanArray

Package:
stx:libbasic
Category:
Collections-Arrayed
Version:
rev: 1.1 date: 2016/10/14 15:46:52
user: cg
file: BooleanArray.st directory: libbasic
module: stx stc-classLibrary: libbasic
Author:
Claus Gittinger

Description:


BooleanArrays are specially tuned to store booleans (true and false), 
and are useful for bulk bit/boolean data. 

Instances require only 1/32th (32bit machines) or even 1/64th (64bit machines)
of memory compared to a regular array of booleans.

They store 8 booleans per byte. 
Since instances store bits in multiples of 8, 
the real size of the collection is kept in an extra instance variable (tally).
It may be useful if huge boolean arrays are to be used.

ATTENTION:
    inheriting from BitArray, bits 1 to 8 of the BooleanArray are stored in bits 8 to 1 
    of the corresponding byte, to allow easy mapping to ASN.1 BIT STRING encoding
    in the BER.
    Do not change this.

[memory requirements:]
    OBJ-HEADER + ((size + 7) // 8)


Related information:

    ByteArray
    WordArray
    Array

Instance protocol:

accessing
o  at: index
retrieve the boolean at index
usage example(s):
     (BooleanArray new:1000) at:555

o  at: index put: aBoolean
store the argument, aBoolean at index; return aBoolean (sigh).

o  occurrencesOf: anElement
count the occurrences of the argument, anElement in the receiver
usage example(s):
     (BooleanArray new:10)
        at:4 put:true;
        at:6 put:true;
        at:7 put:true;
        occurrencesOf:true

filling & replacing
o  atAllPut: aBoolean
replace all elements of the collection by the argument, aBoolean.
The argument, aBoolean must be true or false.
Notice: This operation modifies the receiver, NOT a copy;
therefore the change may affect all others referencing the receiver.

queries
o  defaultElement

o  isValidElement: anObject
return true, if I can hold this kind of object


Examples:


    (BooleanArray new:7) inspect
    (BooleanArray new:7) basicInspect
    |flags|

    flags := BooleanArray new:1000000.
    (flags at:9999) printNL.
    flags at:9999 put:true.
    (flags at:9999) printNL.


ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Mon, 19 Nov 2018 21:56:20 GMT