com.jniwrapper
Class ComplexArray

java.lang.Object
  |
  +--com.jniwrapper.Parameter
        |
        +--com.jniwrapper.Structure
              |
              +--com.jniwrapper.ComplexArray
All Implemented Interfaces:
ArrayParameter

public class ComplexArray
extends Structure
implements ArrayParameter

Represents an array of objects.

All objects in array must have the same type.

Note: If function takes an array as its parameter, you should take Pointer referencing that ComplexArray object, instead of direct taking ComplexArray instance.


Constructor Summary
ComplexArray(Parameter[] arr)
          Constructs array object taking specified Parameter array
ComplexArray(Parameter sample, int count)
          Constructs array object.
 
Method Summary
 java.lang.Object clone()
           
 void fromParameterArray(Parameter[] params)
          Sets array content to the given values
 Parameter getElement(int i)
          Returns array item specified by an index
 int getElementCount()
          Returns items count
 void setElement(int i, Parameter elem)
          Replaces array item by specified object
 void setElementCount(int elementCount)
          Resizes this array to a given size
 Parameter[] toParameterArray()
          Returns items as Java array
 java.lang.String toString()
           
 void write(byte[] arr, int offset)
          Writes the parameter value to a byte array.
 
Methods inherited from class com.jniwrapper.Structure
acceptIOPerformer, computeLength, getLength, getMember, getMembers, init, init, pop, read, setBuffer, write
 
Methods inherited from class com.jniwrapper.Parameter
asReturnValue, equals, getAlignedLength, getBuffer, getOffset, indent, push, read, toByteArray
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ComplexArray

public ComplexArray(Parameter[] arr)
Constructs array object taking specified Parameter array


ComplexArray

public ComplexArray(Parameter sample,
                    int count)
Constructs array object. Fills it with copies of sample object.

Parameters:
sample - Sample for items in constructed array
count - Count of items in constructed array
Method Detail

write

public void write(byte[] arr,
                  int offset)
Description copied from class: Parameter
Writes the parameter value to a byte array.

Overrides:
write in class Parameter

clone

public java.lang.Object clone()
Overrides:
clone in class Structure

getElement

public Parameter getElement(int i)
Description copied from interface: ArrayParameter
Returns array item specified by an index

Specified by:
getElement in interface ArrayParameter
Parameters:
i - index of requested array item

setElement

public void setElement(int i,
                       Parameter elem)
Description copied from interface: ArrayParameter
Replaces array item by specified object

Specified by:
setElement in interface ArrayParameter
Parameters:
i - index of an item to be replaced
elem - object to be set as array item

getElementCount

public int getElementCount()
Description copied from interface: ArrayParameter
Returns items count

Specified by:
getElementCount in interface ArrayParameter

toParameterArray

public Parameter[] toParameterArray()
Description copied from interface: ArrayParameter
Returns items as Java array

Specified by:
toParameterArray in interface ArrayParameter

fromParameterArray

public void fromParameterArray(Parameter[] params)
Description copied from interface: ArrayParameter
Sets array content to the given values

Specified by:
fromParameterArray in interface ArrayParameter

toString

public java.lang.String toString()
Overrides:
toString in class Structure

setElementCount

public void setElementCount(int elementCount)
Description copied from interface: ArrayParameter
Resizes this array to a given size

Specified by:
setElementCount in interface ArrayParameter