back to index

ClassArray

Inheritance

Object -> ClassArray

Properties

numElements - return/set number of used elements
maxElements - return number of available elements
nextFree    - return pointer to next free element
template    - script class template used to allocate array elements

Methods

        add            (Value _object) - add Class object wrapped in Value (read-write); grab reference if compatible (==same class type)
        add            (Class _object) - add read-only Class object; copy reference if compatible (==same class type)
int     alloc          (int _num)      - free current array/discard elements and allocate _num new elements. reset numElements.
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. (no elements will actually be discarded)
        free           ()              - discard elements
Class   get            (int _idx)      - return reference to object at index _idx. return null if _idx crosses array boundaries.
Class   getDeref       (int _idx)      - return class object value at index _idx. return null if _idx crosses array boundaries.
                                         this will remove the object from this array (element will be replaced by null).
Class   getNextFree    ()              - return reference to elements[numElements++]
int     getNumElements ()              - return numElements
int     getMaxElements ()              - return maxElements
Class   getTemplate    ()              - return the script class template object which is used to allocate array elements.
        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 _size)     - reallocate array trying to preserve elements if _size>maxElements.
        reverse        ()              - reverse element order in array
        setNumElements (int _num)      - set number of currently used array elements
        setTemplate    (Class _class)  - set the script class template object. Frees the current array elements.
boolean swap           (int _idxa, _idb) - swap elements 

Examples


back to index