| org.jfree.data.xy.AbstractIntervalXYDataset org.jfree.data.time.DynamicTimeSeriesCollection
DynamicTimeSeriesCollection | public class DynamicTimeSeriesCollection extends AbstractIntervalXYDataset implements IntervalXYDataset,DomainInfo,RangeInfo(Code) | | A dynamic dataset.
Like FastTimeSeriesCollection, this class is a functional replacement
for JFreeChart's TimeSeriesCollection _and_ TimeSeries classes.
FastTimeSeriesCollection is appropriate for a fixed time range; for
real-time applications this subclass adds the ability to append new
data and discard the oldest.
In this class, the arrays used in FastTimeSeriesCollection become FIFO's.
NOTE:As presented here, all data is assumed >= 0, an assumption which is
embodied only in methods associated with interface RangeInfo.
|
Inner Class :protected class ValueSequence | |
Field Summary | |
final public static int | END Useful constant for controlling the x-value returned for a time period. | final public static int | MIDDLE Useful constant for controlling the x-value returned for a time period. | final public static int | START Useful constant for controlling the x-value returned for a time
period. | protected int | historyCount The history count. | protected RegularTimePeriod[] | pointsInTime Storage for the x-values. | protected ValueSequence[] | valueHistory An array for storing the objects that represent each series. | protected Calendar | workingCalendar |
Constructor Summary | |
public | DynamicTimeSeriesCollection(int nSeries, int nMoments) Constructs a dataset with capacity for N series, tied to default
timezone. | public | DynamicTimeSeriesCollection(int nSeries, int nMoments, TimeZone zone) Constructs an empty dataset, tied to a specific timezone. | public | DynamicTimeSeriesCollection(int nSeries, int nMoments, RegularTimePeriod timeSample) Creates a new dataset. | public | DynamicTimeSeriesCollection(int nSeries, int nMoments, RegularTimePeriod timeSample, TimeZone zone) Creates a new dataset. |
Method Summary | |
public void | addSeries(float[] values, int seriesNumber, Comparable seriesKey) Adds a series to the dataset. | public void | addValue(int seriesNumber, int index, float value) Adds a value to a series. | public synchronized RegularTimePeriod | advanceTime() Adjust the array offset as needed when a new time-period is added:
Increments the indices "oldestAt" and "newestAt", mod(array length),
zeroes the series values at newestAt, returns the new TimePeriod. | public void | appendData(float[] newData) Appends new data. | public void | appendData(float[] newData, int insertionIndex, int refresh) Appends data at specified index, for loading up with data from file(s). | protected void | findDomainLimits() Finds the domain limits. | protected double | findMaxValue() Returns the maximum value. | protected void | fireSeriesChanged() Sends a
SeriesChangeEvent to all registered listeners. | public Range | getDomainBounds(boolean includeInterval) Returns the range of the values in this dataset's domain.
Parameters: includeInterval - a flag that determines whether or not thex-interval is taken into account. | public double | getDomainLowerBound(boolean includeInterval) Returns the minimum x-value in the dataset.
Parameters: includeInterval - a flag that determines whether or not thex-interval is taken into account. | public double | getDomainUpperBound(boolean includeInterval) Returns the maximum x-value in the dataset.
Parameters: includeInterval - a flag that determines whether or not thex-interval is taken into account. | public Number | getEndX(int series, int item) Returns the end x-value.
Parameters: series - the series index (zero-based). Parameters: item - the item index (zero-based). | public Number | getEndY(int series, int item) Returns the end y-value.
Parameters: series - the series index (zero-based). Parameters: item - the item index (zero-based). | public int | getItemCount(int series) Returns the number of items in a series.
For this implementation, all series have the same number of items.
Parameters: series - the series index (zero-based). | public int | getNewestIndex() Returns the index of the newest data item. | public RegularTimePeriod | getNewestTime() Returns the newest time. | public int | getOldestIndex() Returns the index of the oldest data item. | public RegularTimePeriod | getOldestTime() Returns the oldest time. | public int | getPosition() Returns the x position type (START, MIDDLE or END). | public Range | getRangeBounds(boolean includeInterval) Returns the value range.
Parameters: includeInterval - a flag that determines whether or not they-interval is taken into account. | public double | getRangeLowerBound(boolean includeInterval) Returns the minimum range value.
Parameters: includeInterval - a flag that determines whether or not they-interval is taken into account. | public double | getRangeUpperBound(boolean includeInterval) Returns the maximum range value.
Parameters: includeInterval - a flag that determines whether or not they-interval is taken into account. | public int | getSeriesCount() Returns the number of series in the collection. | public Comparable | getSeriesKey(int series) Returns the key for a series.
Parameters: series - the series index (zero-based). | public Number | getStartX(int series, int item) Returns the start x-value.
Parameters: series - the series index (zero-based). Parameters: item - the item index (zero-based). | public Number | getStartY(int series, int item) Returns the start y-value.
Parameters: series - the series index (zero-based). Parameters: item - the item index (zero-based). | public Number | getX(int series, int item) Returns the x-value.
Parameters: series - the series index (zero-based). Parameters: item - the item index (zero-based). | public Number | getY(int series, int item) Returns the y-value.
Parameters: series - the series index (zero-based). Parameters: item - the item index (zero-based). | public double | getYValue(int series, int item) Returns the y-value.
Parameters: series - the series index (zero-based). Parameters: item - the item index (zero-based). | public void | invalidateRangeInfo() Invalidates the range info. | public int | offsetFromNewest(int delta) Returns the actual index to a time offset by "delta" from newestAt.
Parameters: delta - the delta. | public int | offsetFromOldest(int delta) | public void | setPosition(int position) Sets the x position type (START, MIDDLE or END). | public void | setSeriesKey(int seriesNumber, Comparable key) Sets the name of a series. | public synchronized long | setTimeBase(RegularTimePeriod start) Fill the pointsInTime with times using TimePeriod.next():
Will silently return if the time array was already populated.
Also computes the data cached for later use by
methods implementing the DomainInfo interface:
Parameters: start - the start. | protected int | translateGet(int toFetch) Re-map an index, for use in retrieving data.
Parameters: toFetch - the index. | protected int | wrapOffset(int protoIndex) ??
Parameters: protoIndex - the index. |
END | final public static int END(Code) | | Useful constant for controlling the x-value returned for a time period.
|
MIDDLE | final public static int MIDDLE(Code) | | Useful constant for controlling the x-value returned for a time period.
|
START | final public static int START(Code) | | Useful constant for controlling the x-value returned for a time
period.
|
historyCount | protected int historyCount(Code) | | The history count.
|
valueHistory | protected ValueSequence[] valueHistory(Code) | | An array for storing the objects that represent each series.
|
workingCalendar | protected Calendar workingCalendar(Code) | | A working calendar (to recycle)
|
DynamicTimeSeriesCollection | public DynamicTimeSeriesCollection(int nSeries, int nMoments)(Code) | | Constructs a dataset with capacity for N series, tied to default
timezone.
Parameters: nSeries - the number of series to be accommodated. Parameters: nMoments - the number of TimePeriods to be spanned. |
DynamicTimeSeriesCollection | public DynamicTimeSeriesCollection(int nSeries, int nMoments, TimeZone zone)(Code) | | Constructs an empty dataset, tied to a specific timezone.
Parameters: nSeries - the number of series to be accommodated Parameters: nMoments - the number of TimePeriods to be spanned Parameters: zone - the timezone. |
DynamicTimeSeriesCollection | public DynamicTimeSeriesCollection(int nSeries, int nMoments, RegularTimePeriod timeSample)(Code) | | Creates a new dataset.
Parameters: nSeries - the number of series. Parameters: nMoments - the number of items per series. Parameters: timeSample - a time period sample. |
DynamicTimeSeriesCollection | public DynamicTimeSeriesCollection(int nSeries, int nMoments, RegularTimePeriod timeSample, TimeZone zone)(Code) | | Creates a new dataset.
Parameters: nSeries - the number of series. Parameters: nMoments - the number of items per series. Parameters: timeSample - a time period sample. Parameters: zone - the time zone. |
addSeries | public void addSeries(float[] values, int seriesNumber, Comparable seriesKey)(Code) | | Adds a series to the dataset. Only the y-values are supplied, the
x-values are specified elsewhere.
Parameters: values - the y-values. Parameters: seriesNumber - the series index (zero-based). Parameters: seriesKey - the series key.Use this as-is during setup only, or add the synchronized keyword around the copy loop. |
addValue | public void addValue(int seriesNumber, int index, float value)(Code) | | Adds a value to a series.
Parameters: seriesNumber - the series index. Parameters: index - ??. Parameters: value - the value. |
advanceTime | public synchronized RegularTimePeriod advanceTime()(Code) | | Adjust the array offset as needed when a new time-period is added:
Increments the indices "oldestAt" and "newestAt", mod(array length),
zeroes the series values at newestAt, returns the new TimePeriod.
The new time period. |
appendData | public void appendData(float[] newData)(Code) | | Appends new data.
Parameters: newData - the data. |
appendData | public void appendData(float[] newData, int insertionIndex, int refresh)(Code) | | Appends data at specified index, for loading up with data from file(s).
Parameters: newData - the data Parameters: insertionIndex - the index value at which to put it Parameters: refresh - value of n in "refresh the display on every nth call"(ignored if <= 0 ) |
findDomainLimits | protected void findDomainLimits()(Code) | | Finds the domain limits. Note: this doesn't need to be synchronized
because it's called from within another method that already is.
|
findMaxValue | protected double findMaxValue()(Code) | | Returns the maximum value.
The maximum value. |
getDomainBounds | public Range getDomainBounds(boolean includeInterval)(Code) | | Returns the range of the values in this dataset's domain.
Parameters: includeInterval - a flag that determines whether or not thex-interval is taken into account. The range. |
getDomainLowerBound | public double getDomainLowerBound(boolean includeInterval)(Code) | | Returns the minimum x-value in the dataset.
Parameters: includeInterval - a flag that determines whether or not thex-interval is taken into account. The minimum value. |
getDomainUpperBound | public double getDomainUpperBound(boolean includeInterval)(Code) | | Returns the maximum x-value in the dataset.
Parameters: includeInterval - a flag that determines whether or not thex-interval is taken into account. The maximum value. |
getEndX | public Number getEndX(int series, int item)(Code) | | Returns the end x-value.
Parameters: series - the series index (zero-based). Parameters: item - the item index (zero-based). The value. |
getEndY | public Number getEndY(int series, int item)(Code) | | Returns the end y-value.
Parameters: series - the series index (zero-based). Parameters: item - the item index (zero-based). The value. |
getItemCount | public int getItemCount(int series)(Code) | | Returns the number of items in a series.
For this implementation, all series have the same number of items.
Parameters: series - the series index (zero-based). The item count. |
getNewestIndex | public int getNewestIndex()(Code) | | Returns the index of the newest data item.
The index. |
getOldestIndex | public int getOldestIndex()(Code) | | Returns the index of the oldest data item.
The index. |
getPosition | public int getPosition()(Code) | | Returns the x position type (START, MIDDLE or END).
The x position type. |
getRangeBounds | public Range getRangeBounds(boolean includeInterval)(Code) | | Returns the value range.
Parameters: includeInterval - a flag that determines whether or not they-interval is taken into account. The range. |
getRangeLowerBound | public double getRangeLowerBound(boolean includeInterval)(Code) | | Returns the minimum range value.
Parameters: includeInterval - a flag that determines whether or not they-interval is taken into account. The minimum range value. |
getRangeUpperBound | public double getRangeUpperBound(boolean includeInterval)(Code) | | Returns the maximum range value.
Parameters: includeInterval - a flag that determines whether or not they-interval is taken into account. The maximum range value. |
getSeriesCount | public int getSeriesCount()(Code) | | Returns the number of series in the collection.
The series count. |
getSeriesKey | public Comparable getSeriesKey(int series)(Code) | | Returns the key for a series.
Parameters: series - the series index (zero-based). The key. |
getStartX | public Number getStartX(int series, int item)(Code) | | Returns the start x-value.
Parameters: series - the series index (zero-based). Parameters: item - the item index (zero-based). The value. |
getStartY | public Number getStartY(int series, int item)(Code) | | Returns the start y-value.
Parameters: series - the series index (zero-based). Parameters: item - the item index (zero-based). The value. |
getX | public Number getX(int series, int item)(Code) | | Returns the x-value.
Parameters: series - the series index (zero-based). Parameters: item - the item index (zero-based). The value. |
getY | public Number getY(int series, int item)(Code) | | Returns the y-value.
Parameters: series - the series index (zero-based). Parameters: item - the item index (zero-based). The value. |
getYValue | public double getYValue(int series, int item)(Code) | | Returns the y-value.
Parameters: series - the series index (zero-based). Parameters: item - the item index (zero-based). The value. |
invalidateRangeInfo | public void invalidateRangeInfo()(Code) | | Invalidates the range info.
|
offsetFromNewest | public int offsetFromNewest(int delta)(Code) | | Returns the actual index to a time offset by "delta" from newestAt.
Parameters: delta - the delta. The offset. |
offsetFromOldest | public int offsetFromOldest(int delta)(Code) | | ??
Parameters: delta - ?? The offset. |
setPosition | public void setPosition(int position)(Code) | | Sets the x position type (START, MIDDLE or END).
Parameters: position - The x position type. |
setSeriesKey | public void setSeriesKey(int seriesNumber, Comparable key)(Code) | | Sets the name of a series. If planning to add values individually.
Parameters: seriesNumber - the series. Parameters: key - the new key. |
setTimeBase | public synchronized long setTimeBase(RegularTimePeriod start)(Code) | | Fill the pointsInTime with times using TimePeriod.next():
Will silently return if the time array was already populated.
Also computes the data cached for later use by
methods implementing the DomainInfo interface:
Parameters: start - the start. ??. |
translateGet | protected int translateGet(int toFetch)(Code) | | Re-map an index, for use in retrieving data.
Parameters: toFetch - the index. The translated index. |
wrapOffset | protected int wrapOffset(int protoIndex)(Code) | | ??
Parameters: protoIndex - the index. The offset. |
Methods inherited from org.jfree.data.xy.AbstractIntervalXYDataset | public double getEndXValue(int series, int item)(Code)(Java Doc) public double getEndYValue(int series, int item)(Code)(Java Doc) public double getStartXValue(int series, int item)(Code)(Java Doc) public double getStartYValue(int series, int item)(Code)(Java Doc)
|
|
|