schmitzm.jfree.feature
Class Feature2DatasetMapping<D extends Dataset,E,F>

java.lang.Object
  extended by schmitzm.jfree.feature.Feature2DatasetMapping<D,E,F>
Direct Known Subclasses:
Feature2CategoryDatasetMapping, Feature2SeriesDatasetMapping

public abstract class Feature2DatasetMapping<D extends Dataset,E,F>
extends Object

This class implements the mapping between Dataset items (points in chart) and the corresponding Features.

D = the dataset type the model handles
E = the data type the series are identified with in the dataset
F = the data type the data items are identified with in each series

Author:
Martin Schmitz

Field Summary
protected  D dataset
          Holds the Dataset for the mapping
protected  Map<E,Map<F,String>> did2fid
          Holds for each series the feature ID (String) for each data item.
protected  FeatureCollection featureCollection
          Holds the FeatureCollection for the mapping
protected  Map<String,Map<E,F>> fid2did
          Holds the data items (Map<SeriesKey,ItemID>) for each feature ID (String).
 
Constructor Summary
Feature2DatasetMapping(FeatureCollection fc, D dataset)
          Creates a mapping.
 
Method Summary
 F getDataID(E seriesKey, String fID)
          Returns the data items for a given feature ID.
 F getDataID(String fID)
          Returns the data items for a given feature IN THE PRIMARY SERIES.
 Map<E,F> getDataIDs(String fID)
          Returns the data items for a given feature ID.
 D getDataset()
          Returns the Dataset the mapping is provided for.
 FeatureCollection getFeatureCollection()
          Returns the FeatureCollection the mapping is provided for.
 String getFeatureID(E seriesKey, F itemID)
          Returns the feature ID for a given data item.
 String getFeatureID(F itemID)
          Returns the feature ID for a given data item IN THE PRIMARY SERIES.
abstract  E getPrimarySeriesKey()
          Returns the key of the primary series.
 void removeMappingForDataItem(E seriesKey, F itemID)
          Removes the mapping for a dataset item.
 void removeMappingForDataItem(F itemID)
          Removes the mapping for a dataset item IN THE PRIMARY SERIES.
 void removeMappingForFeatureID(String fID)
          Removes the mapping of a feature ID.
 void setMapping(String featureID, E seriesKey, F itemID)
          Sets the mapping between a feature ID and a dataset item.
 void setMapping(String featureID, F itemID)
          Sets the mapping between a feature ID and a dataset item IN THE PRIMARY SERIES.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

featureCollection

protected FeatureCollection featureCollection
Holds the FeatureCollection for the mapping


dataset

protected D extends Dataset dataset
Holds the Dataset for the mapping


fid2did

protected Map<String,Map<E,F>> fid2did
Holds the data items (Map<SeriesKey,ItemID>) for each feature ID (String).


did2fid

protected Map<E,Map<F,String>> did2fid
Holds for each series the feature ID (String) for each data item.

Constructor Detail

Feature2DatasetMapping

public Feature2DatasetMapping(FeatureCollection fc,
                              D dataset)
Creates a mapping.

Parameters:
fc - a FeatureCollection (can be null)
Method Detail

getFeatureCollection

public FeatureCollection getFeatureCollection()
Returns the FeatureCollection the mapping is provided for.


getDataset

public D getDataset()
Returns the Dataset the mapping is provided for.


getPrimarySeriesKey

public abstract E getPrimarySeriesKey()
Returns the key of the primary series.


setMapping

public void setMapping(String featureID,
                       F itemID)
Sets the mapping between a feature ID and a dataset item IN THE PRIMARY SERIES.

Parameters:
featureID - feature ID
itemID - defines the dataset item

setMapping

public void setMapping(String featureID,
                       E seriesKey,
                       F itemID)
Sets the mapping between a feature ID and a dataset item.

Parameters:
featureID - feature ID
seriesKey - defines the series in the dataset (if null the primary series is used)
itemID - defines the dataset item in the series

removeMappingForFeatureID

public void removeMappingForFeatureID(String fID)
Removes the mapping of a feature ID.

Parameters:
fID - feature ID

removeMappingForDataItem

public void removeMappingForDataItem(F itemID)
Removes the mapping for a dataset item IN THE PRIMARY SERIES.

Parameters:
itemID - dataset item

removeMappingForDataItem

public void removeMappingForDataItem(E seriesKey,
                                     F itemID)
Removes the mapping for a dataset item.

Parameters:
seriesKey - defines the series in the dataset (if null the primary series is used)
itemID - defines the dataset item in the series

getDataID

public F getDataID(String fID)
Returns the data items for a given feature IN THE PRIMARY SERIES.

Parameters:
fID - a feature ID
Returns:
null if no data item is registered for the feature ID

getDataID

public F getDataID(E seriesKey,
                   String fID)
Returns the data items for a given feature ID.

Parameters:
seriesKey - defines the series in the dataset
fID - a feature ID
Returns:
null if no data item is registered for the feature ID

getFeatureID

public String getFeatureID(F itemID)
Returns the feature ID for a given data item IN THE PRIMARY SERIES.

Parameters:
itemID - a data item
Returns:
null if no feature ID is registered for the data item

getDataIDs

public Map<E,F> getDataIDs(String fID)
Returns the data items for a given feature ID.

Parameters:
fID - a feature ID
Returns:
null if no data item is registered for the feature ID

getFeatureID

public String getFeatureID(E seriesKey,
                           F itemID)
Returns the feature ID for a given data item.

Parameters:
seriesKey - defines the series in the dataset
itemID - defines the dataset item in the series (if null the primary series is used)
Returns:
null if no feature ID is registered for the data item