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
ADataSetis 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 StringDATASETCOLORSCALEstatic StringDATASETDESCRIPTIONprotected intdataSetIDprotected DataSetLayoutPropertiesdatasetPropertiesThe properties to be used for this dataset, need to be set during reading of data.StringDescriptionThe Description of this Dataset.booleanisdiscreetAn Indicator whether this is a discreet data set (i.e.booleanisnumericAn Indicator whether the dataset uses numeric representationbooleanisstringAn Indicator whether the dataset uses numeric representationprotected DoubleMaxValueprotected DoubleMinValuebooleannumericstringsan indicator whether the dataset uses numeric data represented by stringsprotected Vector<DataSetLayoutProperties>propertyOptionsstatic StringPROPERTYOPTIONSAVAILABLEbooleanuseTwoColHeadersAn 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 booleanaddPropertyOption(DataSetLayoutProperties propsToAdd)Add Property options to this Dataset, and indicate whether the addition was successful.abstract Vector<ColorMap>getColorMapOptions()abstract DataContainergetContainerForID(String ID)Get the appropriate DataContainer for an ID.abstract NodeDatagetDataForID(String NodeID)Get theNodeDatafor a specific ID.JPanelgetDataSetDescriptionPane(JScrollPane Legend, String DataSetLabel, ColorMap map)Get a Description of this DataSet in the form of aJPanel.abstract StringgetDataSetTypeName()Get the general Name for this Type of DataSetabstract NodeDatagetDefaultData()Get a default NodeData object for this datasetprotected static PropertiesgetDefaultProperties()abstract Vector<Comparable>getHeaders()Get the Headers in this DataSetabstract intgetID()Get the ID of this set.abstract DataContainergetLayoutContainer(DataSetLayoutProperties properties)Get a sample container for Layout purposesabstract Set<String>getNodeIDs()Get the set of Node IDs contained in thisDataSet.Localisation.PositiongetPreferredposition()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.booleanisFlexibility()Return the flexibility of this dataset for layout purposes.booleanloadWorkBook(IDAREWorkbook WB)This function loads calls the implementing classes function setupWorkBook to interpret the Workbook provided and tests, whether there are viableDataSetLayoutPropertiesin IDARE that can be used with this DataSet and the given Workbook.voidpreProcessWorkBook(IDAREWorkbook WB)Do preprocessing for the setup Process.abstract voidreadWorkBookData(IDAREWorkbook WB)Read the Data for this workbook into the dataset.booleanremovePropertyOption(DataSetLayoutProperties propsToRemove)Remove the given PropertyOptions from this dataset.protected voidreset()reset this Dataset to a stage as if it would have been just initialized.abstract voidsetID(int id)Set the ID of this DataSetvoidsetProperties(DataSetLayoutProperties properties)Set theDataSetLayoutPropertiescurrently used for this datasetvoidsetProperties(Properties props)voidsetPropertyOptionsUnchecked(Collection<DataSetLayoutProperties> options)Sets the Options potentially available to this Dataset.voidsetTwoColumnHeaders(boolean twocols)Define what type of headers are being used.voidsetupPropertyOptions()Set up the property options for thisDataSet.voidsetupWorkBook(IDAREWorkbook WB)Set up the data properties from the provided workbook and read the data into this dataset.IDARECellskipLabels(Iterator<IDARECell> currentiterator)Skip the Cells containing the labels from a cell iteratorStringtoString()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 viableDataSetLayoutPropertiesin 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 WrongFormatSet 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
IDARECellafter 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 theDataSetLayoutPropertiescurrently used for this dataset- Parameters:
properties- TheDataSetLayoutPropertiesto 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 possibleDataSetLayoutPropertiesfor this Dataset
-
addPropertyOption
public final boolean addPropertyOption(DataSetLayoutProperties propsToAdd)
Add Property options to this Dataset, and indicate whether the addition was successful.- Parameters:
propsToAdd- theDataSetLayoutPropertiesto 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 theNodeDatafor a specific ID.- Parameters:
NodeID- The ID of theNodeDatarequested.- 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- TheDataSetLayoutPropertiesfor which to get aDataContainer.- Returns:
- a sample container using Default data.
- Throws:
WrongDatasetTypeException- If the providedDataSetLayoutPropertiescannot 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- TheDataSetLayoutPropertiesoption 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.
-
-