eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'IntegerArray':

Home

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

Class: IntegerArray


Inheritance:

   Object
   |
   +--Collection
      |
      +--SequenceableCollection
         |
         +--ArrayedCollection
            |
            +--UninterpretedBytes
               |
               +--AbstractNumberVector
                  |
                  +--UnboxedIntegerArray
                     |
                     +--IntegerArray

Package:
stx:libbasic
Category:
Collections-Arrayed
Version:
rev: 1.4 date: 2019/03/24 11:26:44
user: cg
file: IntegerArray.st directory: libbasic
module: stx stc-classLibrary: libbasic
Author:
Claus Gittinger

Description:


IntegerArrays store integers in the range 0..16rFFFFFFFF.
In contrast to normal arrays (which store pointers to their elements),
integerArrays store the values in a dense & compact way. 
Since the representation fits the underlying C-language systems representation
of unsigned int32's, this is also useful to pass bulk data to c primitive code.

[memory requirements:]
    OBJ-HEADER + (size * 4)


[caveat:]
    should probably be renamed to UnsignedInt32Array
    


Related information:

    ByteArray
    BooleanArray
    FloatArray
    DoubleArray
    Array
    SignedWordArray
    WordArray

Class protocol:

queries
o  elementByteSize
for bit-like containers, return the number of bytes stored per element.
Here, 4 is returned

o  maxVal
the maximum value which can be stored in instances of me

o  minVal
the minimum value which can be stored in instances of me


Instance protocol:

accessing
o  unsignedInt32At: index MSB: msb
return the 4-bytes starting at index as an (unsigned) Integer.
The index is a smalltalk index (i.e. 1-based).
The value is retrieved MSB (high 8 bits at lower index) if msb is true;
LSB-first (i.e. low 8-bits at lower byte index) if it's false.
Notice:
the index is a byte index; thus, this allows for unaligned access to
words on any boundary.

usage example(s):

     #(16r0201 16r0403 16r0605) asIntegerArray unsignedInt32At:1 MSB:false 
     #(16r0201 16r0403 16r0605) asIntegerArray unsignedInt32At:5 MSB:false
     #(16r0201 16r0403 16r0605) asIntegerArray unsignedInt32At:9 MSB:false

     #(16r0201 16r0403 16r0605) asIntegerArray unsignedInt32At:2 MSB:false
     #(16r0201 16r0403 16r0605) asIntegerArray unsignedInt32At:3 MSB:false
     #(16r0201 16r0403 16r0605) asIntegerArray unsignedInt32At:4 MSB:false

     #(16rFFEE 16r0403 16r0605) asIntegerArray unsignedInt32At:1 MSB:false
     #(16rFFEE 16r0403 16r0605) asIntegerArray unsignedInt32At:1 MSB:true

comparing
o  < anIntegerArray
Compare the receiver with the argument and return true if the
receiver is greater than the argument. Otherwise return false.

Redefined for speed (xpath handling)

usage example(s):

        (IntegerArray newFrom:#[1 2 3 4 5]) < (IntegerArray newFrom:#[1 2 3 4 5])
        (IntegerArray newFrom:#[1 2 3 4 5]) < (IntegerArray newFrom:#[1 2 3 4])
        (IntegerArray newFrom:#[1 2 3 4]) < (IntegerArray newFrom:#[1 2 3 4 5])
        (IntegerArray newFrom:#[1 2 3 4 5]) < (IntegerArray newFrom:#[1 2 3 4 6])
        (IntegerArray newFrom:#[]) < (IntegerArray newFrom:#[1 2 3 4 6])

converting
o  asIntegerArray
return a new IntegerArray with the collection's elements.
That's the receiver itself here



ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Fri, 29 Mar 2024 07:09:59 GMT