common
Class ArrayArray

Object
  extended by common:Array
      extended by common:ArrayArray

class 
Array:ArrayArray

Generic Array dynamic array object wrapper.

This is a generic dynamic array wrapper class for Array data. Note that with this, you can create arrays of arrays, with each nested array having a possibly different number of elements. You can also create arrays of arrays of arrays.

See the Array base class for more information.


Ultra Fractal Source

Toggle UF Source Code Display

 class ArrayArray(Array) {
   ; Generic Array dynamic array object wrapper.
   ; <p>
   ; This is a generic dynamic array wrapper class for
   ; Array data. Note that with this, you can create
   ; arrays of arrays, with each nested array having
   ; a possibly different number of elements. You can
   ; also create arrays of arrays of arrays.
   ; <p>
   ; See the Array base class for more information.
   
 public:
   ; Constructor
   ;
   ; @param plength initial length of the array
   func ArrayArray(int plength)
     setLength(m_Elements, plength)
   endfunc
 
   ; Length wrapper
   ;
   ; @return the number of elements in the array
   int func GetArrayLength()
     return length(m_Elements)
   endfunc
   
   ; setLength wrapper
   ; <p>
   ; This is analagous to UF's native setLength() function
   ; for dynamic arrays.
   ;
   ; @param plength new length of the array
   func SetArrayLength(int plength)
     setLength(m_Elements, plength)
   endfunc
 
   ; Copy
   ; <p>
   ; This performs a "deep" copy, where each element Array
   ; is fully copied to the target ArrayArray object. For
   ; large arrays, this will not be fast.
   ;
   ; @param dest ArrayArray object to copy all values into; previous contents of dest will be discarded.
   func Copy(ArrayArray &dest)
     int l = this.GetArrayLength()
     if (dest == 0)
       dest = new ArrayArray(l)
     else
       dest.SetArrayLength(l)
     endif
     int j = 0
     while (j < l)
       if (BooleanArray(m_Elements[j]))
         BooleanArray ba = BooleanArray(dest.m_Elements[j])
         if (!ba)
           dest.m_Elements[j] = 0
         endif
         BooleanArray(m_Elements[j]).Copy(ba)
         dest.m_Elements[j] = ba
       elseif (IntegerArray(m_Elements[j]))
         IntegerArray ia = IntegerArray(dest.m_Elements[j])
         if (!ia)
           dest.m_Elements[j] = 0
         endif
         IntegerArray(m_Elements[j]).Copy(ia)
         dest.m_Elements[j] = ia
       elseif (FloatArray(m_Elements[j]))
         FloatArray fa = FloatArray(dest.m_Elements[j])
         if (!fa)
           dest.m_Elements[j] = 0
         endif
         FloatArray(m_Elements[j]).Copy(fa)
         dest.m_Elements[j] = fa
       elseif (ComplexArray(m_Elements[j]))
         ComplexArray ca = ComplexArray(dest.m_Elements[j])
         if (!ca)
           dest.m_Elements[j] = 0
         endif
         ComplexArray(m_Elements[j]).Copy(ca)
         dest.m_Elements[j] = ca
       elseif (ColorArray(m_Elements[j]))
         ColorArray pa = ColorArray(dest.m_Elements[j])
         if (!pa)
           dest.m_Elements[j] = 0
         endif
         ColorArray(m_Elements[j]).Copy(pa)
         dest.m_Elements[j] = pa
       elseif (VectorArray(m_Elements[j]))
         VectorArray va = VectorArray(dest.m_Elements[j])
         if (!va)
           dest.m_Elements[j] = 0
         endif
         VectorArray(m_Elements[j]).Copy(va)
         dest.m_Elements[j] = va
       elseif (ArrayArray(m_Elements[j]))
         ArrayArray aa = ArrayArray(dest.m_Elements[j])
         if (!aa)
           dest.m_Elements[j] = 0
         endif
         ArrayArray(m_Elements[j]).Copy(aa)
         dest.m_Elements[j] = aa
       elseif (GenericArray(m_Elements[j]))
         GenericArray ga = GenericArray(dest.m_Elements[j])
         if (!ga)
           dest.m_Elements[j] = 0
         endif
         GenericArray(m_Elements[j]).Copy(ga)
         dest.m_Elements[j] = ga
       else
         dest.m_Elements[j] = m_Elements[j]
       endif
       j = j + 1
     endwhile
   endfunc
 
   ; Array elements (for direct access)
   Array m_Elements[]
   
 default:
 }
 


Constructor Summary
ArrayArray()
           
ArrayArray(int plength)
          Constructor
 
Method Summary
 void Copy(ArrayArray dest)
          Copy
 int GetArrayLength()
          Length wrapper
 void SetArrayLength(int plength)
          setLength wrapper
 
Methods inherited from class Object
 

Constructor Detail

ArrayArray

public ArrayArray(int plength)
Constructor

Parameters:
plength - initial length of the array

ArrayArray

public ArrayArray()
Method Detail

GetArrayLength

public int GetArrayLength()
Length wrapper

Overrides:
GetArrayLength in class Array
Returns:
the number of elements in the array

SetArrayLength

public void SetArrayLength(int plength)
setLength wrapper

This is analagous to UF's native setLength() function for dynamic arrays.

Overrides:
SetArrayLength in class Array
Parameters:
plength - new length of the array

Copy

public void Copy(ArrayArray dest)
Copy

This performs a "deep" copy, where each element Array is fully copied to the target ArrayArray object. For large arrays, this will not be fast.

Parameters:
dest - ArrayArray object to copy all values into; previous contents of dest will be discarded.