Class DataSet

  • All Implemented Interfaces:
    idare.imagenode.internal.IDAREService, Serializable
    Direct Known Subclasses:
    ArrayDataSet, MultiArrayDataSet

    public abstract class DataSet
    extends Object
    implements idare.imagenode.internal.IDAREService, Serializable
    A DataSet 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 Detail

      • DATASETCOLORSCALE

        public static String DATASETCOLORSCALE
      • DATASETDESCRIPTION

        public static String DATASETDESCRIPTION
      • 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.
      • 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 viable DataSetLayoutProperties 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 this DataSet.
        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.
        Overrides:
        toString in class Object
        Returns:
        The description of this set
      • 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 possible DataSetLayoutProperties 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 - the DataSetLayoutProperties 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 a JPanel. 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 adjustments
        DataSetLabel - the label assigned to this dataset for description generation
        map - the colormap assigned to this dataset for layouting
        Returns:
        the JPanel representing the DataDescription.
      • getDataForID

        public abstract NodeData getDataForID​(String NodeID)
        Get the NodeData for a specific ID.
        Parameters:
        NodeID - The ID of the NodeData 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 this DataSet
      • 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 this DataSet.
        Returns:
        the set of node IDs in this DataSet
      • getColorMapOptions

        public abstract Vector<ColorMap> getColorMapOptions()
        Get the ColorMaps available for this DataSet The objects in this vector should always be the same (i.e. two successive calls should yield colormaps that can be compare with ==)
        Returns:
        A collection of ColorMaps available to 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 a DataContainer
        Returns:
        a Container for a specific ID
      • 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 - The DataSetLayoutProperties 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.