The Encog Project

org.encog.neural.data.basic
Class BasicNeuralData

java.lang.Object
  extended by org.encog.neural.data.basic.BasicNeuralData
All Implemented Interfaces:
java.io.Serializable, NeuralData
Direct Known Subclasses:
ImageNeuralData

public class BasicNeuralData
extends java.lang.Object
implements NeuralData, java.io.Serializable

Basic implementation of the NeuralData interface that stores the data in an array.

Author:
jheaton
See Also:
Serialized Form

Constructor Summary
BasicNeuralData(double[] d)
          Construct this object with the specified data.
BasicNeuralData(int size)
          Construct this object with blank data and a specified size.
 
Method Summary
 double[] getData()
          Get the data as an array.
 double getData(int index)
          Get a data value at the specified index.
 void setData(double[] data)
          Set the entire data array.
 void setData(int index, double d)
          Set the data element specified by the index.
 int size()
          Get the number of data elements present.
 java.lang.String toString()
          Return a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicNeuralData

public BasicNeuralData(double[] d)
Construct this object with the specified data.

Parameters:
d - The data to construct this object with.

BasicNeuralData

public BasicNeuralData(int size)
Construct this object with blank data and a specified size.

Parameters:
size - The amount of data to store.
Method Detail

getData

public double[] getData()
Get the data as an array.

Specified by:
getData in interface NeuralData
Returns:
The data held by this object.

getData

public double getData(int index)
Get a data value at the specified index.

Specified by:
getData in interface NeuralData
Parameters:
index - The index to read.
Returns:
The data at the specified index.

setData

public void setData(double[] data)
Set the entire data array.

Specified by:
setData in interface NeuralData
Parameters:
data - The data to store.

setData

public void setData(int index,
                    double d)
Set the data element specified by the index.

Specified by:
setData in interface NeuralData
Parameters:
index - The data element to set.
d - The new value for the specified data element.

size

public int size()
Get the number of data elements present.

Specified by:
size in interface NeuralData
Returns:
The number of data elements present.

toString

public java.lang.String toString()
Return a string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
The string form of this object.

The Encog Project