index of namespace default
 
 index of project core
 
 index of module core

Class core.IntArray


SynopsisAn arraylist of 32bit integer values.

  Base classes:
  Derived classes:
  Methods:
See also:  



Method add
Add the given integer value to this array.
Signature
add(inti)
 :boolean
Arguments
inti
Returns
booleantrue if the value has been added successfully, false otherwise.
Description

Resize array if necessary.

See also:  


 
 top of page
Method add2
Add the given integer values to this array.
Signature
add2(inti1,
  inti2 
  )  
 :boolean
Arguments
inti1First integer value
inti2Second integer value
Returns
booleantrue if the values have been added successfully, false otherwise.
Description

Resize array if necessary.

See also:  


 
 top of page
Method add3
Add the given integer values to this array.
Signature
add3(inti1,
  inti2,
  inti3 
  )  
 :boolean
Arguments
inti1First integer value
inti2Second integer value
inti3Third integer value
Returns
booleantrue if the values have been added successfully, false otherwise.
Description

Resize array if necessary.

See also:  


 
 top of page
Method add4
Add the given integer values to this array.
Signature
add4(inti1,
  inti2,
  inti3,
  inti4 
  )  
 :boolean
Arguments
inti1First integer value
inti2Second integer value
inti3Third integer value
inti4Fourth integer value
Returns
booleantrue if the values have been added successfully, false otherwise.
Description

Resize array if necessary.

See also:  


 
 top of page
Method addArray
Add the given array like object to this array.
Signature
addArray(Objectarray,
  intoff,
  intlen 
  )  
 :boolean
Arguments
ObjectarrayArray-like object
intoffSource offset
intlenNumber of elements
Returns
booleantrue if the array has been added successfully, false otherwise.
Description

Resize array if necessary.

See also:  


 
 top of page
Method addEmpty
Increase numElements by "num".
Signature
addEmpty(intnum)
 :int
Arguments
intnumNumber of elements to add
Returns
intNew number of elements

See also:  


 
 top of page
Method alloc
Allocate the given number of array elements.
Signature
alloc(intmax)
 :int
Arguments
intmaxTotal number of elements to allocate
Returns
inttrue if the allocation succeeded, false otherwise
Description

The numElements member will be set to 0 after allocation and the maxElements memberwill be set to "max".

See also:  


 
 top of page
Method allocAndFill
Allocate and set all used array elements to value "i".
Signature
allocAndFill(intnum,
  inti 
  )  
 :boolean
Arguments
intnumNumber of elements
intiFill value
Returns
booleantrue when allocation succeeded

See also:  


 
 top of page
Method contains
Check whether array contains the given integer value.
Signature
contains(inti)
 :boolean
Arguments
intiValue to look for
Returns
booleantrue(1) if this array contains the given value, false(0) otherwise.

 
 top of page
Method copyFrom
Copy elements from other array.
Signature
copyFrom(IntArraysrc,
  intoff,
  intlen,
  intdestOff 
  )  
Arguments
IntArraysrcSource array
intoffSource offset
intlenNumber of elements to copy
intdestOffDestination offset in this array

 
 top of page
Method dec
Decrement element at index 'idx'.
Signature
dec(intidx)
Arguments
intidx
Description

If the index is out of bounds, simply do nothing.

 
 top of page
Method delete
Delete element at the given index.
Signature
delete(intindex)
 :boolean
Arguments
intindexWhich element to delete
Returns
booleantrue if the element was deleted, false otherwise.

See also:  


 
 top of page
Method delete2
Delete two elements at the given index.
Signature
delete2(intindex)
 :boolean
Arguments
intindexFirst element index
Returns
booleantrue if the element has been deleted, false otherwise.

See also:  


 
 top of page
Method delete3
Delete three elements at the given index.
Signature
delete3(intindex)
 :boolean
Arguments
intindexFirst element index
Returns
booleantrue if the element has been deleted, false otherwise.

See also:  


 
 top of page
Method delete4
Delete four elements at the given index.
Signature
delete4(intindex)
 :boolean
Arguments
intindexFirst element index
Returns
booleantrue if the element has been deleted, false otherwise.

See also:  


 
 top of page
Method empty
Reset the number of used elements, numElements, to 0.
Signature
empty()

 
 top of page
Method fill
Set all used array elements to value "i".
Signature
fill(inti)
Arguments
intiFill value

See also:  


 
 top of page
Method fillRegion
Fill a range of elements with a constant value.
Signature
fillRegion(intoff,
  intlen,
  intval 
  )  
Arguments
intoffStart offset (element index)
intlenNumber of elements
intvalFill value
Description

The region start/end will be clipped to (0;numElements).

See also:  


 
 top of page
Method findSubArrayOffset
Find offset of subarray "ia".
Signature
findSubArrayOffset(IntArrayia)
 :int
Arguments
IntArrayiaSub-array
Returns
intOffset in this array

 
 top of page
Method free
Free array elements.
Signature
free()

See also:  


 
 top of page
Method get
Return element at index "index".
Signature
get(intindex)
 :int
Arguments
intindexArray index
Returns
intElement value
Description

Silently return 0 if index is out of bounds.

 
 top of page
Method getAbsMax
Return biggest array element, not regarding sign.
Signature
getAbsMax():int
Returns
intMaximum value

 
 top of page
Method getAbsMean
Return average element value, not regarding sign.
Signature
getAbsMean():float
Returns
floatAverage value

 
 top of page
Method getAbsMin
Return smallest array element, not regarding sign.
Signature
getAbsMin():int
Returns
intMinimum value

 
 top of page
Method getDefault
Return array element at 'index', or return 'def' when index is out of bounds.
Signature
getDefault(intindex,
  intdef 
  )  
 :int
Arguments
intindexArray index
intdefDefault value (when index is out of bounds)
Returns
intArray element or default value

 
 top of page
Method getFirst
Return first array element.
Signature
getFirst():int
Returns
intFirst array element or 0 if the array is empty.

 
 top of page
Method getLast
Return last used array element.
Signature
getLast():int
Returns
intLast used array element (numElements - 1) or 0 if the array is empty.

 
 top of page
Method getMax
Return biggest array element.
Signature
getMax():int
Returns
intMaximum value

 
 top of page
Method getMaxElements
Return total number of array elements.
Signature
getMaxElements():int
Returns
intTotal number of elements

See also:  


 
 top of page
Method getMean
Return average element value.
Signature
getMean():float
Returns
floatAverage value

 
 top of page
Method getMin
Return smallest array element.
Signature
getMin():int
Returns
intMinimum value

 
 top of page
Method getNumElements
Return number of used array elements.
Signature
getNumElements():int
Returns
intNumber of used array elements

See also:  


 
 top of page
Method getNumUniqueValues
Return number of unique values (ignore duplicates).
Signature
getNumUniqueValues():int
Returns
int

 
 top of page
Method getRev
Return element value at (numElements - 1 - index).
Signature
getRev(intindex)
 :int
Arguments
intindexWhich element to return (starting from numElements)
Returns
intElement value
Description

Silently return 0 if resulting index is out of bounds.

 
 top of page
Method getString
Return string representation of this array.
Signature
getString():String
Returns
StringString representation of this array.

 
 top of page
Method getString2
Return (x;y) pair string representation of this array.
Signature
getString2():String
Returns
Stringnew String

 
 top of page
Method getString3
Return (x;y;z) tuple string representation of this array.
Signature
getString3():String
Returns
Stringnew String

 
 top of page
Method identity
Reallocate array to "num" elements and set element[i] to i.
Signature
identity(intnum)
Arguments
intnumNew number of elements

 
 top of page
Method inc
Increment element at index 'idx'.
Signature
inc(intidx)
Arguments
intidx
Description

If the index is out of bounds, simply do nothing.

 
 top of page
Method indexOf
Return index of element with value "i". -1 if no matching element was found.
Signature
indexOf(inti,
  intoff 
  )  
 :int
Arguments
intiValue to look for
intoffStart index
Returns
intIndex of element, -1 if not found.

 
 top of page
Method indexOfNot
Return index of element that does not have value "i". -1 if no matching element was found.
Signature
indexOfNot(inti,
  intoff 
  )  
 :int
Arguments
intiValue to look for
intoffStart index
Returns
intIndex of element, -1 if not found.

 
 top of page
Method insert
Insert new array element "i" before index "index".
Signature
insert(intindex,
  inti 
  )  
 :boolean
Arguments
intindexWhere to insert the new element
intiNew element value
Returns
boolean
Description

The array will be resized if necessary.

See also:  


 
 top of page
Method isEmpty
Check if array is empty (numElements == 0).
Signature
isEmpty():boolean
Returns
boolean

 
 top of page
Method isEqual
Compare to other array and return true if the array contents are equal.
Signature
isEqual(Arrayo)
 :boolean
Arguments
ArrayoOther array
Returns
booleantrue if the array contents are equal
Description

(note) typecast other array elements to int when necessary.

 
 top of page
Method join
Join arrays 'a' and 'b'.
Signature
join(Objecta,
  Objectb 
  )  
Arguments
ObjectaOther array (or this, or null)
ObjectbOther array (or this, or null)

 
 top of page
Method read16
Read a sequence of 16bit short integers from the given input stream.
Signature
read16(Streamifs,
  intnum,
  intdestOff 
  )  
 :int
Arguments
StreamifsInput stream
intnumNumber of bytes to read.
intdestOffDestination offset in this array
Returns
intNumber of elements read
Description

The shorts will be extended to 32bit integers.

 
 top of page
Method read32
Read a sequence of 32bit integers from the given input stream.
Signature
read32(Streamifs,
  intnum,
  intdestOff 
  )  
 :int
Arguments
StreamifsInput stream
intnumNumber of bytes to read.
intdestOffDestination offset in this array
Returns
intNumber of elements read

 
 top of page
Method read8
Read a sequence of bytes from the given input stream.
Signature
read8(Streamifs,
  intnum,
  intdestOff 
  )  
 :int
Arguments
StreamifsInput stream
intnumNumber of bytes to read.
intdestOffDestination offset in this array
Returns
intNumber of elements read
Description

The bytes will be extended to 32bit integers.

 
 top of page
Method realloc
Reallocate array.
Signature
realloc(intnum)
 :boolean
Arguments
intnumNew total number of elements
Returns
booleantrue when the allocation succeeded, false otherwise.
Description

Array elements will be discarded if the new array size is smallerthan the current size. New array elements are added if the new arraysize is smaller than the current size.

See also:  


 
 top of page
Method rearrange
Reorder elements according to given element order.
Signature
rearrange(IntArrayorder)
 :boolean
Arguments
IntArrayorderNew element order
Returns
booleantrue if elements have been reordered successfully, false otherwise.

 
 top of page
Method remove
Check whether array contains the given integer value and remove it if it does.
Signature
remove(inti)
 :boolean
Arguments
intiValue to look for
Returns
booleantrue(1) if this array contained the given value which is now removed, false(0) otherwise.

 
 top of page
Method replace
Replace all occurences of 'a' with 'b' and return number of elements replaced.
Signature
replace(inta,
  intb 
  )  
 :int
Arguments
intaValue a
intbValue b that replaces a.
Returns
intNumber of elements replaced.

 
 top of page
Method replaceNeg
Replace all occurences of negative values with 'b' and return number of elements replaced.
Signature
replaceNeg(intb)
 :int
Arguments
intbValue b that replaces negative values.
Returns
intNumber of elements replaced.

 
 top of page
Method reverse
Reverse element order.
Signature
reverse()

 
 top of page
Method set
Set element at "index" to "val".
Signature
set(intindex,
  intval 
  )  
Arguments
intindexArray index
intvalNew value
Description
Updates numElements when index exceeds it (>=).
Silently do nothing when index exceed array size (>= maxElements).

 
 top of page
Method setNumElements
Set number of used elements to "num".
Signature
setNumElements(intnum)
Arguments
intnumNew number of used elements
Description

"num" is clamped to 0 resp. to the maxElements member.

 
 top of page
Method setRev
Set element at "numElements - 1 - index" to "val".
Signature
setRev(intindex,
  intval 
  )  
Arguments
intindexArray index (starting from numElements)
intvalNew value
Description

Silently do nothing when index exceed array size (<0 || >= maxElements).

 
 top of page
Method sortByValue
Sort elements by value and return new element order in "r".
Signature
sortByValue(IntArrayr)
Arguments
IntArrayrReceives new element order

 
 top of page
Method swap
Swap two elements.
Signature
swap(intindexA,
  intindexB 
  )  
 :boolean
Arguments
intindexAIndex of first element
intindexBIndex of second element
Returns
booleantrue if elements have been swapped successfully, false otherwise.

 
 top of page
Method swapByteOrder
Swap byteorder of all elements.
Signature
swapByteOrder()

 
 top of page
Method useAll
Mark all array elements used, i.e. set numElements = maxElements.
Signature
useAll()

 
 top of page
Method visit
Create a view into another IntArray object.
Signature
visit(IntArraysrc,
  intoff,
  intnum 
  )  
Arguments
IntArraysrcSource array
intoffSource offset
intnumNumber of elements

 
 top of page
Method visitBytes
Create a view into another array-like object.
Signature
visitBytes(Objectsrc,
  intoff,
  intnum 
  )  
 :boolean
Arguments
ObjectsrcSource array object. Must have integer element type and linear memory layout (i.e. stride=width*elementByteSize)
intoffSource offset
intnumNumber of elements
Returns
booleantrue if the view was created, false otherwise.
Description

Keep in mind not to delete the "src" array while this object is still alive!

 
 top of page
Method write16
Write a sequence of 16bit short integers to the given output stream.
Signature
write16(Streamifs,
  intnum,
  intsrcOff 
  )  
 :int
Arguments
Streamifs
intnumNumber of shorts to write
intsrcOffSource offset in this array
Returns
intNumber of elements written
Description

The array elements will be truncated to 16bit.

 
 top of page
Method write32
Write a sequence of 32bit integers to the given output stream.
Signature
write32(Streamifs,
  intnum,
  intsrcOff 
  )  
 :int
Arguments
Streamifs
intnumNumber of shorts to write
intsrcOffSource offset in this array
Returns
intNumber of elements written

 
 top of page
Method write8
Write a sequence of 8bit bytes to the given output stream.
Signature
write8(Streamifs,
  intnum,
  intsrcOff 
  )  
 :int
Arguments
Streamifs
intnumNumber of bytes to write
intsrcOffSource offset in this array
Returns
intNumber of elements written
Description

The array elements will be truncated to 8bit.

 
 top of page
 

Project Modules:core 
Project Classes:Boolean , Buffer , Byte , Class , ClassArray , Condition , Configuration , Double , DummyStream , Envelope , Event , Exception , File , Float , FloatArray , FloatArray128 , FloatArray16 , FloatArray32 , FloatArray64 , FloatArray8 , Function , HashTable , IntArray , IntArray128 , IntArray16 , IntArray32 , IntArray64 , IntArray8 , Integer , LFSR , LFSR_NR , List , ListNode , Long , Mailbox , Mutex , Object , ObjectArray , PakFile , PointerArray , Pool , Process , Script , SharedBuffer , Short , Stack , StdErrStream , StdInStream , StdOutStream , Stream , String , String128 , String16 , String32 , String64 , String8 , StringArray , StringIterator , Thread , Time , TKS , TreeNode , UnsignedByte , UnsignedInteger , UnsignedLong , UnsignedShort , Value , ValueArray , Variable 
Project Functions:ceil , exit , floor , GetCurrentThread , getenv , lcchar , mathAbsMaxf , mathAbsMinf , mathAbsMini , mathAbsMini , mathCerpf , mathClampf , mathClampi , mathDistancePointPlane2d , mathFoldf , mathFoldi , mathGCD , mathLerpCyclicf , mathLerpf , mathMaxf , mathMaxi , mathMinf , mathMini , mathNextCyclicf , mathPowerf , mathPowerfC , mathPoweri , mathSerpf , mathSmoothStepf , mathSmoothStepNf , mathWrapf , mathWrapi , milliSeconds , milliSecondsDouble , psystem , putenv , srand , system , ucchar 
All Namespaces:default , graph , ui 
All Projects:core , eqxmms , ShaderVG , ShaderVG_Text , tkanalogrytm , tkchipmunk , tkclap , tkfileutils , tkfreeglut , tkfreetype2 , tkfreeverb , tkmath , tkmidi , tkmidipipe , tkminnie , tkoldmath , tkopengl , tkportaudio , tkradiastools , tksamplechain , tksampleedit , tksampler , tksdl , tksdl_net , tksidplay2 , tkspeexdsp , tksqlite , tktriangulate , tkui , tkvst2 , tkzip , ui , yingtest 


auto-generated by "DOG", the TkScript document generator. Thu, 11/Dec/2025 13:41:59