Class DataSet
- java.lang.Object
-
- idare.imagenode.Interfaces.DataSets.DataSet
-
- All Implemented Interfaces:
IDAREService
,Serializable
- Direct Known Subclasses:
ArrayDataSet
,MultiArrayDataSet
public abstract class DataSet extends Object implements IDAREService, Serializable
ADataSet
is a storage for data. This abstract class provides several utility methods which are common to most datasets (such as the determination of some properties for datasets).- Author:
- Thomas Pfau
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
DATASETCOLORSCALE
static String
DATASETDESCRIPTION
protected int
dataSetID
protected DataSetLayoutProperties
datasetProperties
The properties to be used for this dataset, need to be set during reading of data.String
Description
The Description of this Dataset.boolean
isdiscreet
An Indicator whether this is a discreet data set (i.e.boolean
isnumeric
An Indicator whether the dataset uses numeric representationboolean
isstring
An Indicator whether the dataset uses numeric representationprotected Double
MaxValue
protected Double
MinValue
boolean
numericstrings
an indicator whether the dataset uses numeric data represented by stringsprotected Vector<DataSetLayoutProperties>
propertyOptions
static String
PROPERTYOPTIONSAVAILABLE
boolean
useTwoColHeaders
An Indicator whether this dataset uses one or two columns to provide label/IDprotected Vector<Comparable>
Valueset
-
Constructor Summary
Constructors Constructor Description DataSet()
DataSet(int DataSetID, boolean useTowColHeaders, Properties props)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
addPropertyOption(DataSetLayoutProperties propsToAdd)
Add Property options to this Dataset, and indicate whether the addition was successful.abstract Vector<ColorMap>
getColorMapOptions()
abstract DataContainer
getContainerForID(String ID)
Get the appropriate DataContainer for an ID.abstract NodeData
getDataForID(String NodeID)
Get theNodeData
for a specific ID.JPanel
getDataSetDescriptionPane(JScrollPane Legend, String DataSetLabel, ColorMap map)
Get a Description of this DataSet in the form of aJPanel
.abstract String
getDataSetTypeName()
Get the general Name for this Type of DataSetabstract NodeData
getDefaultData()
Get a default NodeData object for this datasetprotected static Properties
getDefaultProperties()
abstract Vector<Comparable>
getHeaders()
Get the Headers in this DataSetabstract int
getID()
Get the ID of this set.abstract DataContainer
getLayoutContainer(DataSetLayoutProperties properties)
Get a sample container for Layout purposesabstract Set<String>
getNodeIDs()
Get the set of Node IDs contained in thisDataSet
.Localisation.Position
getPreferredposition()
Get the preferred layout localisation of this datasetVector<DataSetLayoutProperties>
getPropertyOptions()
Get the selection of different properties available for this datasetDouble[]
getYAxisLimits()
Get the limits (minimum and maximum value) if this is a numeric dataset.boolean
isFlexibility()
Return the flexibility of this dataset for layout purposes.boolean
loadWorkBook(IDAREWorkbook WB)
This function loads calls the implementing classes function setupWorkBook to interpret the Workbook provided and tests, whether there are viableDataSetLayoutProperties
in IDARE that can be used with this DataSet and the given Workbook.void
preProcessWorkBook(IDAREWorkbook WB)
Do preprocessing for the setup Process.abstract void
readWorkBookData(IDAREWorkbook WB)
Read the Data for this workbook into the dataset.boolean
removePropertyOption(DataSetLayoutProperties propsToRemove)
Remove the given PropertyOptions from this dataset.protected void
reset()
reset this Dataset to a stage as if it would have been just initialized.abstract void
setID(int id)
Set the ID of this DataSetvoid
setProperties(DataSetLayoutProperties properties)
Set theDataSetLayoutProperties
currently used for this datasetvoid
setProperties(Properties props)
void
setPropertyOptionsUnchecked(Collection<DataSetLayoutProperties> options)
Sets the Options potentially available to this Dataset.void
setTwoColumnHeaders(boolean twocols)
Define what type of headers are being used.void
setupPropertyOptions()
Set up the property options for thisDataSet
.void
setupWorkBook(IDAREWorkbook WB)
Set up the data properties from the provided workbook and read the data into this dataset.IDARECell
skipLabels(Iterator<IDARECell> currentiterator)
Skip the Cells containing the labels from a cell iteratorString
toString()
The String representation of a DataSet is its description.
-
-
-
Field Detail
-
DATASETCOLORSCALE
public static String DATASETCOLORSCALE
-
DATASETDESCRIPTION
public static String DATASETDESCRIPTION
-
PROPERTYOPTIONSAVAILABLE
public static final String PROPERTYOPTIONSAVAILABLE
- See Also:
- Constant Field Values
-
isnumeric
public boolean isnumeric
An Indicator whether the dataset uses numeric representation
-
isstring
public boolean isstring
An Indicator whether the dataset uses numeric representation
-
numericstrings
public boolean numericstrings
an indicator whether the dataset uses numeric data represented by strings
-
isdiscreet
public boolean isdiscreet
An Indicator whether this is a discreet data set (i.e. no more than 5 different values)
-
useTwoColHeaders
public boolean useTwoColHeaders
An Indicator whether this dataset uses one or two columns to provide label/ID
-
Description
public String Description
The Description of this Dataset.
-
datasetProperties
protected DataSetLayoutProperties datasetProperties
The properties to be used for this dataset, need to be set during reading of data.
-
propertyOptions
protected Vector<DataSetLayoutProperties> propertyOptions
-
Valueset
protected Vector<Comparable> Valueset
-
dataSetID
protected int dataSetID
-
MinValue
protected Double MinValue
-
MaxValue
protected Double MaxValue
-
-
Constructor Detail
-
DataSet
public DataSet()
-
DataSet
public DataSet(int DataSetID, boolean useTowColHeaders, Properties props)
-
-
Method Detail
-
getDefaultProperties
protected static Properties getDefaultProperties()
-
setProperties
public void setProperties(Properties props)
-
loadWorkBook
public final boolean loadWorkBook(IDAREWorkbook WB) throws WrongFormat, DuplicateIDException, IOException
This function loads calls the implementing classes function setupWorkBook to interpret the Workbook provided and tests, whether there are viableDataSetLayoutProperties
in IDARE that can be used with this DataSet and the given Workbook.- Parameters:
WB
- The Workbook this DataSet should use to obtain data- Returns:
- whether the parsing was successful
- Throws:
WrongFormat
- if none of the readers can read the file properly.DuplicateIDException
- if there are duplicate ids in the files.IOException
- if there is a problem with the provided file.
-
reset
protected void reset()
reset this Dataset to a stage as if it would have been just initialized.
-
setTwoColumnHeaders
public void setTwoColumnHeaders(boolean twocols)
Define what type of headers are being used.- Parameters:
twocols
- whether to use two column headers when parsing
-
setupWorkBook
public final void setupWorkBook(IDAREWorkbook WB) throws WrongFormat, DuplicateIDException
Set up the data properties from the provided workbook and read the data into this dataset.- Parameters:
WB
- The WorkBook- Throws:
WrongFormat
- if there are problems with the format of the data in the Workbook.DuplicateIDException
- if there are duplicate IDs in the Workbook (e.g. sheets which have the same identifier twice).
-
setupPropertyOptions
public void setupPropertyOptions() throws WrongFormat
Set up the property options for thisDataSet
.- Throws:
WrongFormat
- if there are no layout properties fitting to this type of dataset.
-
skipLabels
public IDARECell skipLabels(Iterator<IDARECell> currentiterator)
Skip the Cells containing the labels from a cell iterator- Parameters:
currentiterator
- the Celliterator for a specific row.- Returns:
- the
IDARECell
after skippning columns for the labels.
-
isFlexibility
public boolean isFlexibility()
Return the flexibility of this dataset for layout purposes.- Returns:
- whether this dataset can be layed out flexible or not
-
getPreferredposition
public Localisation.Position getPreferredposition()
Get the preferred layout localisation of this dataset- Returns:
- the preferred position.
-
toString
public String toString()
The String representation of a DataSet is its description.
-
setProperties
public void setProperties(DataSetLayoutProperties properties)
Set theDataSetLayoutProperties
currently used for this dataset- Parameters:
properties
- TheDataSetLayoutProperties
to use for layout of thisDataSet
-
getPropertyOptions
public final Vector<DataSetLayoutProperties> getPropertyOptions()
Get the selection of different properties available for this dataset- Returns:
- The possible DataSetproperties for this Type of Dataset
-
setPropertyOptionsUnchecked
public final void setPropertyOptionsUnchecked(Collection<DataSetLayoutProperties> options)
Sets the Options potentially available to this Dataset. This call does not check, whether the options supplied are actually viable options for this dataset!- Parameters:
options
- The possibleDataSetLayoutProperties
for this Dataset
-
addPropertyOption
public final boolean addPropertyOption(DataSetLayoutProperties propsToAdd)
Add Property options to this Dataset, and indicate whether the addition was successful.- Parameters:
propsToAdd
- theDataSetLayoutProperties
to add to this dataset.- Returns:
- whether the Properties were added. Returns false if either the properties are not valid or are already part of the propertyset
-
getYAxisLimits
public Double[] getYAxisLimits()
Get the limits (minimum and maximum value) if this is a numeric dataset.- Returns:
- if the dataset is numeric, an Array of two doubles with result[0] being the minimum and results[1] being the maximal value. Otherwise null.
-
getDataSetDescriptionPane
public JPanel getDataSetDescriptionPane(JScrollPane Legend, String DataSetLabel, ColorMap map)
Get a Description of this DataSet in the form of aJPanel
. The function provides the Legend this is associated with (to be able to adjust the size of components for proper scaling).- Parameters:
Legend
- The scroll pane to use for width adjustmentsDataSetLabel
- the label assigned to this dataset for description generationmap
- the colormap assigned to this dataset for layouting- Returns:
- the JPanel representing the DataDescription.
-
getDataForID
public abstract NodeData getDataForID(String NodeID)
Get theNodeData
for a specific ID.- Parameters:
NodeID
- The ID of theNodeData
requested.- Returns:
- the requested NodeData (if it is not present an appropriate empty entry should be returned.)
-
setID
public abstract void setID(int id)
Set the ID of this DataSet- Parameters:
id
- The ID assigned to thisDataSet
-
getID
public abstract int getID()
Get the ID of this set.- Returns:
- the internal ID of this
DataSet
-
getNodeIDs
public abstract Set<String> getNodeIDs()
Get the set of Node IDs contained in thisDataSet
.- Returns:
- the set of node IDs in this
DataSet
-
readWorkBookData
public abstract void readWorkBookData(IDAREWorkbook WB) throws WrongFormat, DuplicateIDException
Read the Data for this workbook into the dataset. This function should also remove any inappropriate property options, as those can only be determined now.- Parameters:
WB
- The IDAREWorkbook to read from.- Throws:
WrongFormat
- If there is a format problem in the Workbook (mix numeric/string, invalid string o.รค.)DuplicateIDException
- If there are duplicate IDs in the Workbook that is being loaded.
-
getContainerForID
public abstract DataContainer getContainerForID(String ID)
Get the appropriate DataContainer for an ID.- Parameters:
ID
- the ID for which to get aDataContainer
- Returns:
- a Container for a specific ID
-
getLayoutContainer
public abstract DataContainer getLayoutContainer(DataSetLayoutProperties properties) throws WrongDatasetTypeException
Get a sample container for Layout purposes- Parameters:
properties
- TheDataSetLayoutProperties
for which to get aDataContainer
.- Returns:
- a sample container using Default data.
- Throws:
WrongDatasetTypeException
- If the providedDataSetLayoutProperties
cannot be used with this Dataset
-
getDefaultData
public abstract NodeData getDefaultData()
Get a default NodeData object for this dataset- Returns:
- the Default Data used in this dataset.
-
getHeaders
public abstract Vector<Comparable> getHeaders()
Get the Headers in this DataSet- Returns:
- return all headers (either Double or String) in this
DataSet
.
-
removePropertyOption
public final boolean removePropertyOption(DataSetLayoutProperties propsToRemove)
Remove the given PropertyOptions from this dataset.- Parameters:
propsToRemove
- TheDataSetLayoutProperties
option to remove- Returns:
- whether the property was remoed from the set of properties (i.e. if it had been present)
-
getDataSetTypeName
public abstract String getDataSetTypeName()
Get the general Name for this Type of DataSet- Returns:
- The Type of Dataset (as String)
-
preProcessWorkBook
public void preProcessWorkBook(IDAREWorkbook WB) throws WrongFormat
Do preprocessing for the setup Process. This function is called before the actual data setup.- Parameters:
WB
- The WorkBook to be preprocessed- Throws:
WrongFormat
- if the Workbook does not have a valid Layouting format, or if the WorkBook does not stick to any possible Data Types.
-
-