gpalta.core
Class Output

java.lang.Object
  extended by gpalta.core.Output
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class Output
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

Stores the outputs of an individual. It can be used to represent multi-dimensional outputs

See Also:
Serialized Form

Constructor Summary
Output(int dim, int nSamples)
          Creates a new instance of Output
 
Method Summary
 java.lang.Object clone()
           
 double[] getArray(int wDim)
          Get an array representing outputs for each sample
 double[] getArrayCopy(int wDim)
          Get an independent array representing outputs for each sample
 int getDim()
          Get the dimension (number of scalar outputs per sample) of this Output
 void setArray(int wDim, double[] array)
          Register an array to this Output object.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Output

public Output(int dim,
              int nSamples)
Creates a new instance of Output

Method Detail

clone

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

getArray

public double[] getArray(int wDim)
Get an array representing outputs for each sample

Parameters:
wDim - Which dimension of the output to get. For uni-dimensional problems, this should be zero
Returns:
A pointer to the actual array. A pointer is returned instead of a copy for efficiency. Modifying the contents of this array can be problematic if this output object is associated with an individual

setArray

public void setArray(int wDim,
                     double[] array)
Register an array to this Output object. Note that this will only set a pointer to the actual array. This is done to avoid calling a method for every sample. Setting all the values on an array and then linking to it is much faster than calling a method every time. Consequently, if this output is going to be stored, caution must be taken to not modify the contents of the pointed array unintentionally.

Parameters:
wDim -
array -

getArrayCopy

public double[] getArrayCopy(int wDim)
Get an independent array representing outputs for each sample

Parameters:
wDim - Wich dimension of the output to get. For uni-dimensional problems, this should be zero
Returns:
A new array with all the outputs

getDim

public int getDim()
Get the dimension (number of scalar outputs per sample) of this Output