lnsc
Class DataSetCollection

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

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

Zero-based ordered collection of data sets containing similar data. Those data can be directly access throught their name and data set index.

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

Constructor Summary
DataSetCollection()
          Creates an empy data set collection with initial size INITIAL_SIZE.
DataSetCollection(DataSet[] newDataSets)
          Creates a data set collection with initial data set into it.
DataSetCollection(int initialSize)
          Creates an empty data set collection with given initial size.
 
Method Summary
 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, int dataIndex)
          Returns the data stored under a given name and index.
 java.lang.Object[] getDataCollection(java.lang.String dataName)
          Returns the data collection stored under a given name.
 int getDataCount()
          Returns the number of data items in the data set collection.
 DataSet getDataSet(int index)
          Returns the data set stored under a given index.
 int getDataSetCount()
          Returns the number of data sets in the collection.
 boolean hasData(java.lang.String dataName)
          Indicates whether the set contains data collection under a given name.
 void removeAllBut(java.lang.String[] keepList)
          Removes all the data collection in the set except the desired ones.
 java.lang.Object[] removeData(java.lang.String dataName)
          Removes the data collection 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 collection is stored.
 void setData(java.lang.String dataName, int dataIndex, java.lang.Object data)
          Stores some data under a given name and index.
 void setDataSet(int dataIndex, DataSet dataSet, boolean overwrite)
          Stores a data set under a given index.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataSetCollection

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


DataSetCollection

public DataSetCollection(DataSet[] newDataSets)
Creates a data set collection with initial data set into it.

Parameters:
newDataSets - Array of corresponding data sets.

DataSetCollection

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

Parameters:
initialSize - The initial size.
Method Detail

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,
                                int dataIndex)
Returns the data stored under a given name and index.

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

getDataCollection

public java.lang.Object[] getDataCollection(java.lang.String dataName)
Returns the data collection stored under a given name.

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

getDataCount

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

Returns:
Number of data items in the data set collection.

getDataSet

public DataSet getDataSet(int index)
Returns the data set stored under a given index.

Parameters:
index - Index of the data set to be retrieved.
Returns:
The set of datas stored under the given index.

getDataSetCount

public int getDataSetCount()
Returns the number of data sets in the collection.

Returns:
Number of data sets in the collection.

hasData

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

Parameters:
dataName - The name to verify if some data collection 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 collection in the set except the desired ones.


removeData

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

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

renameData

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

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

setData

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

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

setDataSet

public void setDataSet(int dataIndex,
                       DataSet dataSet,
                       boolean overwrite)
Stores a data set under a given index.

Parameters:
dataIndex - Index under which the data will be stored.
dataSet - Data set to be stored.
overwrite - When true, data already existing is overwritten, otherwise, it the data is not added.

toString

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