common
Class VectorArray

Object
  extended by common:Array
      extended by common:VectorArray

class 
Array:VectorArray

Generic Vector dynamic array object wrapper.

This is a generic dynamic array wrapper class for Vector data. See the Array base class for more information.


Ultra Fractal Source

Toggle UF Source Code Display

 class VectorArray(Array) {
   ; Generic Vector dynamic array object wrapper.
   ; <p>
   ; This is a generic dynamic array wrapper class for
   ; Vector data. See the Array base class for more
   ; information.
 
 public:
   ; Constructor
   ;
   ; @param plength initial length of the array
   func VectorArray(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 (must be implemented in each type)
   ;
   ; @param dest VectorArray object to copy all values into; previous contents of dest will be discarded.
   func Copy(VectorArray &dest)
     int l = this.GetArrayLength()
     if (dest == 0)
       dest = new VectorArray(l)
     else
       dest.SetArrayLength(l)
     endif
     int j = 0
     while (j < l)
       if (m_Elements[j] == 0)
         dest.m_Elements[j] = 0
       else
         if (dest.m_Elements[j] == 0)
           dest.m_Elements[j] = new Vector(m_Elements[j].m_x,m_Elements[j].m_y,m_Elements[j].m_z,m_Elements[j].m_w)
         else
           m_Elements[j].Copy(dest.m_Elements[j])
         endif
       endif
       j = j + 1
     endwhile
   endfunc
 
   ; Array elements (for direct access)
   Vector m_Elements[]
   
 default:
 }
 


Constructor Summary
VectorArray()
           
VectorArray(int plength)
          Constructor
 
Method Summary
 void Copy(VectorArray dest)
          Copy (must be implemented in each type)
 int GetArrayLength()
          Length wrapper
 void SetArrayLength(int plength)
          setLength wrapper
 
Methods inherited from class Object
 

Constructor Detail

VectorArray

public VectorArray(int plength)
Constructor

Parameters:
plength - initial length of the array

VectorArray

public VectorArray()
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(VectorArray dest)
Copy (must be implemented in each type)

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