interface.
| Constructor: |
public DefaultWindDataset() {
this.seriesKeys = new java.util.ArrayList();
this.allSeriesData = new java.util.ArrayList();
}
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. |
public DefaultWindDataset(Object[][][] data) {
this(seriesNameListFromDataArray(data), data);
}
Constructs a dataset based on the specified data array. Parameters:
data - the data (null not permitted).
Throws:
NullPointerException - if data is null.
|
public DefaultWindDataset(String[] seriesNames,
Object[][][] data) {
this(Arrays.asList(seriesNames), data);
}
Constructs a dataset based on the specified data array. Parameters:
seriesNames - the names of the series (null not
permitted).
data - the wind data.
Throws:
NullPointerException - if seriesNames is
null.
|
public DefaultWindDataset(List seriesKeys,
Object[][][] data) {
if (seriesKeys == null) {
throw new IllegalArgumentException("Null 'seriesKeys' argument.");
}
if (seriesKeys.size() != data.length) {
throw new IllegalArgumentException("The number of series keys does "
+ "not match the number of series in the data array.");
}
this.seriesKeys = seriesKeys;
int seriesCount = data.length;
this.allSeriesData = new java.util.ArrayList(seriesCount);
for (int seriesIndex = 0; seriesIndex < seriesCount; seriesIndex++) {
List oneSeriesData = new java.util.ArrayList();
int maxItemCount = data[seriesIndex].length;
for (int itemIndex = 0; itemIndex < maxItemCount; itemIndex++) {
Object xObject = data[seriesIndex][itemIndex][0];
if (xObject != null) {
Number xNumber;
if (xObject instanceof Number) {
xNumber = (Number) xObject;
}
else {
if (xObject instanceof Date) {
Date xDate = (Date) xObject;
xNumber = new Long(xDate.getTime());
}
else {
xNumber = new Integer(0);
}
}
Number windDir = (Number) data[seriesIndex][itemIndex][1];
Number windForce = (Number) data[seriesIndex][itemIndex][2];
oneSeriesData.add(new WindDataItem(xNumber, windDir,
windForce));
}
}
Collections.sort(oneSeriesData);
this.allSeriesData.add(seriesIndex, oneSeriesData);
}
}
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 a
Date or a Number that 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 (null not
permitted).
data - the wind dataset (null not permitted).
Throws:
IllegalArgumentException - if seriesKeys is
null.
IllegalArgumentException - if the number of series keys does not
match the number of series in the array.
NullPointerException - if data is null.
|
| Method from org.jfree.data.xy.DefaultWindDataset Detail: |
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof DefaultWindDataset)) {
return false;
}
DefaultWindDataset that = (DefaultWindDataset) obj;
if (!this.seriesKeys.equals(that.seriesKeys)) {
return false;
}
if (!this.allSeriesData.equals(that.allSeriesData)) {
return false;
}
return true;
}
Checks this WindDataset for equality with an arbitrary
object. This method returns true if and only if:
obj is not null;
obj is an instance of
DefaultWindDataset;
- both datasets have the same number of series containing identical
values.
|
public int getItemCount(int series) {
if (series < 0 || series >= getSeriesCount()) {
throw new IllegalArgumentException("Invalid series index: "
+ series);
}
List oneSeriesData = (List) this.allSeriesData.get(series);
return oneSeriesData.size();
}
Returns the number of items in a series. |
public int getSeriesCount() {
return this.allSeriesData.size();
}
Returns the number of series in the dataset. |
public Comparable getSeriesKey(int series) {
if (series < 0 || series >= getSeriesCount()) {
throw new IllegalArgumentException("Invalid series index: "
+ series);
}
return (Comparable) this.seriesKeys.get(series);
}
Returns the key for a series. |
public Number getWindDirection(int series,
int item) {
List oneSeriesData = (List) this.allSeriesData.get(series);
WindDataItem windItem = (WindDataItem) oneSeriesData.get(item);
return windItem.getWindDirection();
}
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. |
public Number getWindForce(int series,
int item) {
List oneSeriesData = (List) this.allSeriesData.get(series);
WindDataItem windItem = (WindDataItem) oneSeriesData.get(item);
return windItem.getWindForce();
}
Returns the wind force for one item within a series. This is a number
between 0 and 12, as defined by the Beaufort scale. |
public Number getX(int series,
int item) {
List oneSeriesData = (List) this.allSeriesData.get(series);
WindDataItem windItem = (WindDataItem) oneSeriesData.get(item);
return windItem.getX();
}
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. |
public Number getY(int series,
int item) {
return getWindForce(series, item);
}
Returns the y-value for one item within a series. This maps to the
#getWindForce(int, int) method and is implemented because
WindDataset is an extension of XYDataset . |
public static List seriesNameListFromDataArray(Object[][] data) {
int seriesCount = data.length;
List seriesNameList = new java.util.ArrayList(seriesCount);
for (int i = 0; i < seriesCount; i++) {
seriesNameList.add("Series " + (i + 1));
}
return seriesNameList;
}
Utility method for automatically generating series names. |