back to index

ObjectArray

Inheritance

Object -> ObjectArray

Properties

numElements - number of used elements 
maxElements - number of available elements 
nextFree    - return elements[num_elements++] 
template    - set array template, e.g. oa.template=Time;

Methods

boolean add            (Object _o)       - adds non-deletable reference to _o. resizes array if necessary.
boolean add            (Value _o)        - adds value-wrapped deletable reference to _o. resizes array if necessary.
int     alloc          (int _num)        - discards all elements and allocates new elements
boolean contains       (Object _o)       - return true if array contains an object which looks like _o (yacEquals()) 
        delete         (int _idx)        - delete object at index _idx
        empty          ()                - reset numElements to 0
        free           ()                - reset numElements and maxElements to 0
Object  get            (int _idx)        - return reference to object at index _idx. return null if _idx crosses array boundaries.
Object  getDeref       (int _idx)        - return object value at index _idx. return null if _idx crosses array boundaries.
                                           this will remove the object from the array (reference is replaced by null).
Object  getNextFree    ()                - return elements[num_elements++]
int     getNumElements ()                - return number of used elements
int     getMaxElements ()                - return current element buffer size
String  getString      ()                - convert array to string representation
Object  getTemplate    ()
        insert         (int _idx, Class _object) - insert a copy of _object at index _idx
        insert         (int _idx, Value _object) - insert Value-wrapped _object at index _idx
int     realloc        (int _num)        - resize array
        reverse        ()
        setNumElements (int _num)        - 
        setTemplate    (Object _t)       - 
boolean swap           (int _idxa, _idb) - swap elements 

Examples


back to index