Package org.jfree.data.xy
Class DefaultWindDataset
- java.lang.Object
-
- org.jfree.data.general.AbstractDataset
-
- org.jfree.data.general.AbstractSeriesDataset
-
- org.jfree.data.xy.AbstractXYDataset
-
- org.jfree.data.xy.DefaultWindDataset
-
- All Implemented Interfaces:
java.io.ObjectInputValidation,java.io.Serializable,java.lang.Cloneable,java.util.EventListener,PublicCloneable,Dataset,SeriesChangeListener,SeriesDataset,WindDataset,XYDataset
public class DefaultWindDataset extends AbstractXYDataset implements WindDataset, PublicCloneable
A default implementation of theWindDatasetinterface.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.ListallSeriesDataStorage for the series data.private java.util.ListseriesKeysThe keys for the series.
-
Constructor Summary
Constructors Constructor Description DefaultWindDataset()Constructs a new, empty, dataset.DefaultWindDataset(java.lang.Object[][][] data)Constructs a dataset based on the specified data array.DefaultWindDataset(java.lang.String[] seriesNames, java.lang.Object[][][] data)Constructs a dataset based on the specified data array.DefaultWindDataset(java.util.List seriesKeys, java.lang.Object[][][] data)Constructs a dataset based on the specified data array.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)Checks thisWindDatasetfor equality with an arbitrary object.intgetItemCount(int series)Returns the number of items in a series.intgetSeriesCount()Returns the number of series in the dataset.java.lang.ComparablegetSeriesKey(int series)Returns the key for a series.java.lang.NumbergetWindDirection(int series, int item)Returns the wind direction for one item within a series.java.lang.NumbergetWindForce(int series, int item)Returns the wind force for one item within a series.java.lang.NumbergetX(int series, int item)Returns the x-value for one item within a series.java.lang.NumbergetY(int series, int item)Returns the y-value for one item within a series.static java.util.ListseriesNameListFromDataArray(java.lang.Object[][] data)Utility method for automatically generating series names.-
Methods inherited from class org.jfree.data.xy.AbstractXYDataset
getDomainOrder, getXValue, getYValue
-
Methods inherited from class org.jfree.data.general.AbstractSeriesDataset
indexOf, seriesChanged
-
Methods inherited from class org.jfree.data.general.AbstractDataset
addChangeListener, canEqual, clone, fireDatasetChanged, getGroup, getNotify, hashCode, hasListener, notifyListeners, removeChangeListener, setGroup, setNotify, validateObject
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jfree.data.general.Dataset
addChangeListener, getGroup, removeChangeListener, setGroup
-
Methods inherited from interface org.jfree.chart.util.PublicCloneable
clone
-
Methods inherited from interface org.jfree.data.general.SeriesDataset
indexOf
-
Methods inherited from interface org.jfree.data.xy.XYDataset
getDomainOrder, getXValue, getYValue
-
-
-
-
Constructor Detail
-
DefaultWindDataset
public DefaultWindDataset()
Constructs a new, empty, dataset. Since there are currently no methods to add data to an existing dataset, you should probably use a different constructor.
-
DefaultWindDataset
public DefaultWindDataset(java.lang.Object[][][] data)
Constructs a dataset based on the specified data array.- Parameters:
data- the data (nullnot permitted).- Throws:
java.lang.NullPointerException- ifdataisnull.
-
DefaultWindDataset
public DefaultWindDataset(java.lang.String[] seriesNames, java.lang.Object[][][] data)Constructs a dataset based on the specified data array.- Parameters:
seriesNames- the names of the series (nullnot permitted).data- the wind data.- Throws:
java.lang.NullPointerException- ifseriesNamesisnull.
-
DefaultWindDataset
public DefaultWindDataset(java.util.List seriesKeys, java.lang.Object[][][] data)Constructs a dataset based on the specified data array. The array can contain multiple series, each series can contain multiple items, and each item is as follows:data[series][item][0]- the date (either aDateor aNumberthat is the milliseconds since 1-Jan-1970);data[series][item][1]- the wind direction (1 - 12, like the numbers on a clock face);data[series][item][2]- the wind force (1 - 12 on the Beaufort scale)
- Parameters:
seriesKeys- the names of the series (nullnot permitted).data- the wind dataset (nullnot permitted).- Throws:
java.lang.IllegalArgumentException- ifseriesKeysisnull.java.lang.IllegalArgumentException- if the number of series keys does not match the number of series in the array.java.lang.NullPointerException- ifdataisnull.
-
-
Method Detail
-
getSeriesCount
public int getSeriesCount()
Returns the number of series in the dataset.- Specified by:
getSeriesCountin interfaceSeriesDataset- Specified by:
getSeriesCountin classAbstractSeriesDataset- Returns:
- The series count.
-
getItemCount
public int getItemCount(int series)
Returns the number of items in a series.- Specified by:
getItemCountin interfaceXYDataset- Parameters:
series- the series (zero-based index).- Returns:
- The item count.
-
getSeriesKey
public java.lang.Comparable getSeriesKey(int series)
Returns the key for a series.- Specified by:
getSeriesKeyin interfaceSeriesDataset- Specified by:
getSeriesKeyin classAbstractSeriesDataset- Parameters:
series- the series (zero-based index).- Returns:
- The series key.
-
getX
public java.lang.Number getX(int series, int item)Returns the x-value for one item within a series. This should represent a point in time, encoded as milliseconds in the same way as java.util.Date.
-
getY
public java.lang.Number getY(int series, int item)Returns the y-value for one item within a series. This maps to thegetWindForce(int, int)method and is implemented becauseWindDatasetis an extension ofXYDataset.
-
getWindDirection
public java.lang.Number getWindDirection(int series, int item)Returns the wind direction for one item within a series. This is a number between 0 and 12, like the numbers on an upside-down clock face.- Specified by:
getWindDirectionin interfaceWindDataset- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The wind direction for the item within the series.
-
getWindForce
public java.lang.Number getWindForce(int series, int item)Returns the wind force for one item within a series. This is a number between 0 and 12, as defined by the Beaufort scale.- Specified by:
getWindForcein interfaceWindDataset- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The wind force for the item within the series.
-
seriesNameListFromDataArray
public static java.util.List seriesNameListFromDataArray(java.lang.Object[][] data)
Utility method for automatically generating series names.- Parameters:
data- the wind data (nullnot permitted).- Returns:
- An array of Series N with N = { 1 .. data.length }.
- Throws:
java.lang.NullPointerException- ifdataisnull.
-
equals
public boolean equals(java.lang.Object obj)
Checks thisWindDatasetfor equality with an arbitrary object. This method returnstrueif and only if:objis notnull;objis an instance ofDefaultWindDataset;- both datasets have the same number of series containing identical values.
- Overrides:
equalsin classAbstractDataset- Parameters:
obj- the object (nullpermitted).- Returns:
- A boolean.
-
-