eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'SignedByteArray':

Home

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

Class: SignedByteArray


Inheritance:

   Object
   |
   +--Collection
      |
      +--SequenceableCollection
         |
         +--ArrayedCollection
            |
            +--UninterpretedBytes
               |
               +--ByteArray
                  |
                  +--SignedByteArray

Package:
stx:libbasic
Category:
Collections-Arrayed
Version:
rev: 1.5 date: 2017/04/12 08:30:20
user: cg
file: SignedByteArray.st directory: libbasic
module: stx stc-classLibrary: libbasic
Author:
Stefan Vogel

Description:


Instances of this class hold signed bytes in the range -128 ... +127.


Related information:

    ByteArray

Class protocol:

queries
o  maxVal
the maximum value which can be stored in instances of me.
For SignedByteArrays, this is 127 (largest 8bit signed int)

o  minVal
the minimum value which can be stored in instances of me.
For SignedByteArrays, this is -128 (smallest 8bit signed int)


Instance protocol:

accessing
o  basicAt: index
return the indexed instance variable with index, anInteger
- redefined here to return a signed interger.

o  basicAt: index put: value
set the indexed instance variable with index, anInteger to value.
Returns value (sigh).
- redefined here to allow value to be a signed integer
usage example(s):
       (self new:5) basicAt:1 put:-1; yourself

converting
o  asSignedByteArray

o  asUnsignedByteArray
Answer a unsigned byte array.
elements < 0 are converted to positive numbers.
usage example(s):
        #(-1 -128 3 4) asSignedByteArray asUnsignedByteArray

o  beSigned
that's what I am

o  beUnsigned
make myself unsigned.
elements < 0 are converted to positive numbers.
usage example(s):
        #(-1 -128 3 4) asSignedByteArray beUnsigned

filling & replacing
o  from: start to: stop put: aNumber
fill part of the receiver with aNumber.
- reimplemented here for speed
usage example(s):
     (self new:10) from:1 to:10 put:-5
     (self new:20) from:10 to:20 put:-5
     (self new:20) from:1 to:10 put:-5

queries
o  max
return the maximum value in the receiver -
redefined to speedup image processing and sound-player
(which need a fast method for this on byteArrays)
usage example(s):
     #[1 2 3 -11 2 3 1 2 19] max
     #(-1 -2 -3 -4) asSignedByteArray max
     #() asSignedByteArray max
     #[] max   
     #() max   

searching
o  indexOf: aByte startingAt: start
return the index of the first occurrence of the argument, aByte
in the receiver starting at start, anInteger; return 0 if not found.
- reimplemented here for speed
usage example(s):
     #(-1 2 3 -4 5 6 7 8 9 0 1 2 3 4 5) asSignedByteArray indexOf:0 startingAt:1
     #(-1 2 3 -4 5 6 7 8 9 0 1 2 3 4 5) asSignedByteArray indexOf:-4 startingAt:1
     #() asSignedByteArray indexOf:-4 startingAt:1  
     #() indexOf:-4 startingAt:1     



ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Sat, 23 Mar 2019 08:28:32 GMT