|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jfree.data.AbstractDataset | +--org.jfree.data.AbstractSeriesDataset | +--org.jfree.data.time.DynamicTimeSeriesCollection
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.
Nested Class Summary | |
protected class |
DynamicTimeSeriesCollection.ValueSequence
A wrapper for a fixed array of float values. |
Field Summary | |
static int |
END
Useful constant for controlling the x-value returned for a time period. |
protected int |
historyCount
The history count. |
static int |
MIDDLE
Useful constant for controlling the x-value returned for a time period. |
protected RegularTimePeriod[] |
pointsInTime
Storage for the x-values. |
static int |
START
Useful constant for controlling the x-value returned for a time period. |
protected DynamicTimeSeriesCollection.ValueSequence[] |
valueHistory
An array for storing the objects that represent each series. |
protected java.util.Calendar |
workingCalendar
A working calendar (to recycle) |
Constructor Summary | |
DynamicTimeSeriesCollection(int nSeries,
int nMoments)
Constructs a dataset with capacity for N series, tied to default timezone. |
|
DynamicTimeSeriesCollection(int nSeries,
int nMoments,
RegularTimePeriod timeSample)
Creates a new dataset. |
|
DynamicTimeSeriesCollection(int nSeries,
int nMoments,
RegularTimePeriod timeSample,
java.util.TimeZone zone)
Creates a new dataset. |
|
DynamicTimeSeriesCollection(int nSeries,
int nMoments,
java.util.TimeZone zone)
Constructs an empty dataset, tied to a specific timezone. |
Method Summary | |
void |
addSeries(float[] values,
int seriesNumber,
java.lang.String seriesName)
Adds a series to the dataset. |
void |
addValue(int seriesNumber,
int index,
float value)
Adds a value to a series. |
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. |
void |
appendData(float[] newData)
Appends new data. |
protected void |
findDomainLimits()
Finds the domain limits. |
protected float |
findMaxValue()
Returns the maximum value. |
protected void |
fireSeriesChanged()
Sends a SeriesChangeEvent to all registered listeners. |
Range |
getDomainRange()
Returns the range of values for the domain. |
java.lang.Number |
getEndXValue(int series,
int item)
Returns the end x-value. |
java.lang.Number |
getEndYValue(int series,
int item)
Returns the end y-value. |
int |
getItemCount(int series)
Returns the number of items in a series. |
java.lang.Number |
getMaximumDomainValue()
Returns the maximum value in the dataset (or null if all the values in the domain are null). |
java.lang.Number |
getMaximumRangeValue()
Returns the maximum range value. |
java.lang.Number |
getMinimumDomainValue()
Returns the minimum value in the dataset (or null if all the values in the domain are null). |
java.lang.Number |
getMinimumRangeValue()
Returns the minimum range value. |
int |
getNewestIndex()
Returns the index of the newest data item. |
RegularTimePeriod |
getNewestTime()
Returns the newest time. |
int |
getOldestIndex()
Returns the index of the oldest data item. |
RegularTimePeriod |
getOldestTime()
Returns the oldest time. |
int |
getPosition()
Returns the x position type (START, MIDDLE or END). |
int |
getSeriesCount()
Returns the number of series in the collection. |
java.lang.String |
getSeriesName(int series)
Returns the name of a series. |
java.lang.Number |
getStartXValue(int series,
int item)
Returns the start x-value. |
java.lang.Number |
getStartYValue(int series,
int item)
Returns the start y-value. |
Range |
getValueRange()
Returns the value range. |
java.lang.Number |
getXValue(int series,
int item)
Returns the x-value. |
float |
getY(int series,
int item)
Returns the y-value. |
java.lang.Number |
getYValue(int series,
int item)
Returns the y-value. |
void |
invalidateRangeInfo()
Invalidates the range info. |
int |
offsetFromNewest(int delta)
Returns the actual index to a time offset by "delta" from newestAt. |
int |
offsetFromOldest(int delta)
?? |
void |
setPosition(int position)
Sets the x position type (START, MIDDLE or END). |
void |
setSeriesName(int seriesNumber,
java.lang.String newName)
Sets the name of a series. |
long |
setTimeBase(RegularTimePeriod start)
Fill the pointsInTime with times using TimePeriod.next(): Will silently return if the time array was already populated. |
protected int |
translateGet(int toFetch)
Re-map an index, for use in retrieving data. |
protected int |
wrapOffset(int protoIndex)
?? |
Methods inherited from class org.jfree.data.AbstractSeriesDataset |
seriesChanged |
Methods inherited from class org.jfree.data.AbstractDataset |
addChangeListener, fireDatasetChanged, getGroup, notifyListeners, removeChangeListener, setGroup |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.jfree.data.Dataset |
addChangeListener, getGroup, removeChangeListener, setGroup |
Field Detail |
public static final int START
public static final int MIDDLE
public static final int END
protected int historyCount
protected RegularTimePeriod[] pointsInTime
protected DynamicTimeSeriesCollection.ValueSequence[] valueHistory
protected java.util.Calendar workingCalendar
Constructor Detail |
public DynamicTimeSeriesCollection(int nSeries, int nMoments)
nSeries
- the number of series to be accommodated.nMoments
- the number of TimePeriods to be spanned.public DynamicTimeSeriesCollection(int nSeries, int nMoments, java.util.TimeZone zone)
nSeries
- the number of series to be accommodatednMoments
- the number of TimePeriods to be spannedzone
- the timezone.public DynamicTimeSeriesCollection(int nSeries, int nMoments, RegularTimePeriod timeSample)
nSeries
- the number of series.nMoments
- the number of items per series.timeSample
- a time period sample.public DynamicTimeSeriesCollection(int nSeries, int nMoments, RegularTimePeriod timeSample, java.util.TimeZone zone)
nSeries
- the number of series.nMoments
- the number of items per series.timeSample
- a time period sample.zone
- the time zone.Method Detail |
public long setTimeBase(RegularTimePeriod start)
start
- the start.
protected void findDomainLimits()
Note: this doesn't need to be synchronized because it's called from within another method that already is.
public int getPosition()
public void setPosition(int position)
position
- The x position type.public void addSeries(float[] values, int seriesNumber, java.lang.String seriesName)
values
- the y-values.seriesNumber
- the series index (zero-based).seriesName
- the seriesName.
Use this as-is during setup only, or add the synchronized keyword around the copy loop.public void setSeriesName(int seriesNumber, java.lang.String newName)
If planning to add values individually.
seriesNumber
- the series.newName
- the new name.public void addValue(int seriesNumber, int index, float value)
seriesNumber
- the series index.index
- ??.value
- the value.public int getSeriesCount()
getSeriesCount
in interface SeriesDataset
getSeriesCount
in class AbstractSeriesDataset
public int getItemCount(int series)
For this implementation, all series have the same number of items.
getItemCount
in interface XYDataset
series
- the series index (zero-based).
protected int translateGet(int toFetch)
toFetch
- the index.
public int offsetFromNewest(int delta)
delta
- the delta.
public int offsetFromOldest(int delta)
delta
- ??
protected int wrapOffset(int protoIndex)
protoIndex
- the index.
public RegularTimePeriod advanceTime()
public void invalidateRangeInfo()
protected float findMaxValue()
public int getOldestIndex()
public int getNewestIndex()
public void appendData(float[] newData)
newData
- the data.public RegularTimePeriod getNewestTime()
public RegularTimePeriod getOldestTime()
public java.lang.Number getXValue(int series, int item)
getXValue
in interface XYDataset
series
- the series index (zero-based).item
- the item index (zero-based).
public float getY(int series, int item)
series
- the series index (zero-based).item
- the item index (zero-based).
public java.lang.Number getYValue(int series, int item)
getYValue
in interface XYDataset
series
- the series index (zero-based).item
- the item index (zero-based).
public java.lang.Number getStartXValue(int series, int item)
getStartXValue
in interface IntervalXYDataset
series
- the series index (zero-based).item
- the item index (zero-based).
public java.lang.Number getEndXValue(int series, int item)
getEndXValue
in interface IntervalXYDataset
series
- the series index (zero-based).item
- the item index (zero-based).
public java.lang.Number getStartYValue(int series, int item)
getStartYValue
in interface IntervalXYDataset
series
- the series index (zero-based).item
- the item index (zero-based).
public java.lang.Number getEndYValue(int series, int item)
getEndYValue
in interface IntervalXYDataset
series
- the series index (zero-based).item
- the item index (zero-based).
public java.lang.String getSeriesName(int series)
getSeriesName
in interface SeriesDataset
getSeriesName
in class AbstractSeriesDataset
series
- the series index (zero-based).
protected void fireSeriesChanged()
SeriesChangeEvent
to all registered listeners.
public Range getDomainRange()
getDomainRange
in interface DomainInfo
public java.lang.Number getMinimumDomainValue()
getMinimumDomainValue
in interface DomainInfo
public java.lang.Number getMaximumDomainValue()
getMaximumDomainValue
in interface DomainInfo
public java.lang.Number getMinimumRangeValue()
getMinimumRangeValue
in interface RangeInfo
public java.lang.Number getMaximumRangeValue()
getMaximumRangeValue
in interface RangeInfo
public Range getValueRange()
getValueRange
in interface RangeInfo
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |