home
 
 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 array element "i".
Signature
add(inti)
Arguments
intiThe integer value to add to this arraylist
Description

The array will be re-allocated if necessary. The numElements member will be incremented.
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 member will be set to "max".
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 index "index".
Signature
delete(intindex)
 :boolean
Arguments
intindexWhich index to delete
Returns
booleantrue when the element was deleted successfully, 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 free
Free array elements.
Signature
free()
See also:  


 
 top of page
Method get
Return element at index "index".
Signature
get(indexindex)
 :int
Arguments
indexindexArray 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 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 getString
Return string representation of this array.
Signature
getString():String
Returns
StringString representation of this array.

 
 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 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 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 smaller than the current size. New array elements are added if the new array size 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 replace
Replace all occurences of 'a' with 'b' and return number of elements replaced.
Signature
replace(inta,
  intb 
  )  
Arguments
intaValue a
intbValue b that replaces a.

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

 
 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 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 , List , ListNode , Long , Mailbox , Mutex , Object , ObjectArray , PakFile , PointerArray , Pool , 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 , mathClampf , mathClampi , mathDistancePointPlane2d , mathLerpf , mathMaxf , mathMaxi , mathMinf , mathMini , mathPowerf , mathPoweri , mathSmoothStepf , mathWrapf , mathWrapi , milliSeconds , psystem , putenv , srand , system , ucchar 
All Namespaces:default , ui 
All Projects:core , debugtext , tkfreetype2 , tkmath , tkmidi , tkopengl , tkportaudio , tksdl , tkui , tkunit 


auto-generated by "DOG", the TkScript document generator. Mon, 28/Dec/2015 13:15:54