Save This Page
Home » jcommon-1.0.13 » org.jfree » data » time » [javadoc | source]
org.jfree.data.time
public class: DynamicTimeSeriesCollection [javadoc | source]
java.lang.Object
   org.jfree.data.general.AbstractDataset
      org.jfree.data.general.AbstractSeriesDataset
         org.jfree.data.xy.AbstractXYDataset
            org.jfree.data.xy.AbstractIntervalXYDataset
               org.jfree.data.time.DynamicTimeSeriesCollection

All Implemented Interfaces:
    DomainInfo, RangeInfo, IntervalXYDataset, XYDataset, SeriesDataset, Serializable, SeriesChangeListener, Cloneable, Dataset, ObjectInputValidation

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
public static final  int START    Useful constant for controlling the x-value returned for a time period. 
public static final  int MIDDLE    Useful constant for controlling the x-value returned for a time period. 
public static final  int END    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  DynamicTimeSeriesCollection.ValueSequence[] valueHistory    An array for storing the objects that represent each series. 
protected  Calendar workingCalendar    A working calendar (to recycle) 
Constructor:
 public DynamicTimeSeriesCollection(int nSeries,
    int nMoments) 
 public DynamicTimeSeriesCollection(int nSeries,
    int nMoments,
    TimeZone zone) 
    Constructs an empty dataset, tied to a specific timezone.
    Parameters:
    nSeries - the number of series to be accommodated
    nMoments - the number of TimePeriods to be spanned
    zone - the timezone.
 public DynamicTimeSeriesCollection(int nSeries,
    int nMoments,
    RegularTimePeriod timeSample) 
    Creates a new dataset.
    Parameters:
    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,
    TimeZone zone) 
    Creates a new dataset.
    Parameters:
    nSeries - the number of series.
    nMoments - the number of items per series.
    timeSample - a time period sample.
    zone - the time zone.
Method from org.jfree.data.time.DynamicTimeSeriesCollection Summary:
addSeries,   addValue,   advanceTime,   appendData,   appendData,   findDomainLimits,   findMaxValue,   fireSeriesChanged,   getDomainBounds,   getDomainLowerBound,   getDomainUpperBound,   getEndX,   getEndY,   getItemCount,   getNewestIndex,   getNewestTime,   getOldestIndex,   getOldestTime,   getPosition,   getRangeBounds,   getRangeLowerBound,   getRangeUpperBound,   getSeriesCount,   getSeriesKey,   getStartX,   getStartY,   getX,   getY,   getYValue,   invalidateRangeInfo,   offsetFromNewest,   offsetFromOldest,   setPosition,   setSeriesKey,   setTimeBase,   translateGet,   wrapOffset
Methods from org.jfree.data.xy.AbstractIntervalXYDataset:
getEndXValue,   getEndYValue,   getStartXValue,   getStartYValue
Methods from org.jfree.data.xy.AbstractXYDataset:
getDomainOrder,   getXValue,   getYValue
Methods from org.jfree.data.general.AbstractSeriesDataset:
getSeriesCount,   getSeriesKey,   indexOf,   seriesChanged
Methods from org.jfree.data.general.AbstractDataset:
addChangeListener,   clone,   fireDatasetChanged,   getGroup,   hasListener,   notifyListeners,   removeChangeListener,   setGroup,   validateObject
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.jfree.data.time.DynamicTimeSeriesCollection Detail:
 public  void addSeries(float[] values,
    int seriesNumber,
    Comparable seriesKey) 
    Adds a series to the dataset. Only the y-values are supplied, the x-values are specified elsewhere.
 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. Note: this doesn't need to be synchronized because it's called from within another method that already is.
 protected double findMaxValue() 
    Returns the maximum value.
 protected  void fireSeriesChanged() 
 public Range getDomainBounds(boolean includeInterval) 
    Returns the range of the values in this dataset's domain.
 public double getDomainLowerBound(boolean includeInterval) 
    Returns the minimum x-value in the dataset.
 public double getDomainUpperBound(boolean includeInterval) 
    Returns the maximum x-value in the dataset.
 public Number getEndX(int series,
    int item) 
    Returns the end x-value.
 public Number getEndY(int series,
    int item) 
    Returns the end y-value.
 public int getItemCount(int series) 
    Returns the number of items in a series.

    For this implementation, all series have the same number of items.

 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.
 public double getRangeLowerBound(boolean includeInterval) 
    Returns the minimum range value.
 public double getRangeUpperBound(boolean includeInterval) 
    Returns the maximum range value.
 public int getSeriesCount() 
    Returns the number of series in the collection.
 public Comparable getSeriesKey(int series) 
    Returns the key for a series.
 public Number getStartX(int series,
    int item) 
    Returns the start x-value.
 public Number getStartY(int series,
    int item) 
    Returns the start y-value.
 public Number getX(int series,
    int item) 
    Returns the x-value.
 public Number getY(int series,
    int item) 
    Returns the y-value.
 public double getYValue(int series,
    int item) 
    Returns the y-value.
 public  void invalidateRangeInfo() 
    Invalidates the range info.
 public int offsetFromNewest(int delta) 
    Returns the actual index to a time offset by "delta" from newestAt.
 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. If planning to add values individually.
 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:
 protected int translateGet(int toFetch) 
    Re-map an index, for use in retrieving data.
 protected int wrapOffset(int protoIndex) 
    ??