lnsc
Class DataSet

java.lang.Object
  |
  +--lnsc.DataSet
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

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

Container for input patterns set and all relevant information such as output patterns set, target patterns set, error patterns set, internal values and others. Objects are stored and retrieved in it using names assigned to them. Basically any kind of data can be placed in it, but a certain number of names are reserved for some specific data.

Since:
1.0
See Also:
DataNames, DataSetCollection, Serialized Form

Constructor Summary
DataSet()
          Creates an empy data set with initial size INITIAL_SIZE.
DataSet(DataSet newDataSet)
          Creates a data set with the same refered data as another one.
DataSet(int initialSize)
          Creates an empty data set with given initial size.
DataSet(java.lang.String[] newDataNames, java.lang.Object[] newDatas)
          Creates a data set with initial data into it.
 
Method Summary
 void addDataSet(DataSet dataSet, boolean overwrite)
          Adds the content of a second data set to the data set.
 void addDataSetww(DataSet dataSet, boolean overwrite)
          Adds the content of a second data set to the data set.
 java.lang.String[] dataNamesList()
          Returns a list of the names of the data contained in the set.
 java.lang.Object getData(java.lang.String dataName)
          Returns the data stored under a given name.
 int getDataCount()
          Returns the number of items in the data set.
 boolean hasData(java.lang.String dataName)
          Indicates whether the set contains data under a given name.
 void removeAllBut(java.lang.String[] keepList)
          Removes all the data in the set except the desired ones.
 java.lang.Object removeData(java.lang.String dataName)
          Removes the data stored under a given name and returns it.
 java.lang.Object renameData(java.lang.String oldDataName, java.lang.String newDataName)
          Changes the name under which some data is stored.
 void setData(java.lang.String dataName, java.lang.Object data)
          Stores some data under a given name.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataSet

public DataSet()
Creates an empy data set with initial size INITIAL_SIZE.


DataSet

public DataSet(DataSet newDataSet)
Creates a data set with the same refered data as another one.

Parameters:
newDataSet - The data set from which to take references.

DataSet

public DataSet(int initialSize)
Creates an empty data set with given initial size.

Parameters:
initialSize - The initial size.

DataSet

public DataSet(java.lang.String[] newDataNames,
               java.lang.Object[] newDatas)
Creates a data set with initial data into it.

Parameters:
newDataNames - Array of data names.
newDatas - Array of corresponding datas.
Method Detail

addDataSet

public void addDataSet(DataSet dataSet,
                       boolean overwrite)
Adds the content of a second data set to the data set.

Parameters:
dataSet - The data set to add.
overwrite - When true, data already existing is overwritten, otherwise, it the data is not added.

addDataSetww

public void addDataSetww(DataSet dataSet,
                         boolean overwrite)
Adds the content of a second data set to the data set. No warning is given.

Parameters:
dataSet - The data set to add.
overwrite - When true, data already existing is overwritten, otherwise, it the data is not added.

dataNamesList

public java.lang.String[] dataNamesList()
Returns a list of the names of the data contained in the set.

Returns:
List of the names of data in the set.

getData

public java.lang.Object getData(java.lang.String dataName)
Returns the data stored under a given name.

Parameters:
dataName - Name of the data to be retrieved.
Returns:
The data stored under the given name.

getDataCount

public int getDataCount()
Returns the number of items in the data set.

Returns:
Number of items in the data set.

hasData

public boolean hasData(java.lang.String dataName)
Indicates whether the set contains data under a given name.

Parameters:
dataName - The name to verify if some data is attached to it.
Returns:
true if there is some data under the given name.

removeAllBut

public void removeAllBut(java.lang.String[] keepList)
Removes all the data in the set except the desired ones.


removeData

public java.lang.Object removeData(java.lang.String dataName)
Removes the data stored under a given name and returns it.

Parameters:
dataName - Name of the data to remove.
Returns:
The removed data.

renameData

public java.lang.Object renameData(java.lang.String oldDataName,
                                   java.lang.String newDataName)
Changes the name under which some data is stored.

Parameters:
oldDataName - Name associate to the data.
newDataName - New name to associate to the data.
Returns:
The data associated to the name change.

setData

public void setData(java.lang.String dataName,
                    java.lang.Object data)
Stores some data under a given name.

Parameters:
dataName - Name under which the data will be stored.
data - Data to be stored.

toString

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