Save This Page
Home » jcommon-1.0.13 » org.jfree » data » time » [javadoc | source]
org.jfree.data.time
public class: TimeSeries [javadoc | source]
java.lang.Object
   org.jfree.data.general.Series
      org.jfree.data.time.TimeSeries

All Implemented Interfaces:
    Cloneable, Serializable

Represents a sequence of zero or more data items in the form (period, value).
Field Summary
protected static final  String DEFAULT_DOMAIN_DESCRIPTION    Default value for the domain description. 
protected static final  String DEFAULT_RANGE_DESCRIPTION    Default value for the range description. 
protected  Class timePeriodClass    The type of period for the data. 
protected  List data    The list of data items in the series. 
Constructor:
 public TimeSeries(Comparable name) 
    Creates a new (empty) time series. By default, a daily time series is created. Use one of the other constructors if you require a different time period.
    Parameters:
    name - the series name (null not permitted).
 public TimeSeries(Comparable name,
    Class timePeriodClass) 
    Creates a new (empty) time series with the specified name and class of RegularTimePeriod .
    Parameters:
    name - the series name (null not permitted).
    timePeriodClass - the type of time period (null not permitted).
 public TimeSeries(Comparable name,
    String domain,
    String range,
    Class timePeriodClass) 
    Creates a new time series that contains no data.

    Descriptions can be specified for the domain and range. One situation where this is helpful is when generating a chart for the time series - axis labels can be taken from the domain and range description.

    Parameters:
    name - the name of the series (null not permitted).
    domain - the domain description (null permitted).
    range - the range description (null permitted).
    timePeriodClass - the type of time period (null not permitted).
Method from org.jfree.data.time.TimeSeries Summary:
add,   add,   add,   add,   add,   add,   addAndOrUpdate,   addOrUpdate,   addOrUpdate,   clear,   clone,   createCopy,   createCopy,   delete,   delete,   equals,   getDataItem,   getDataItem,   getDomainDescription,   getIndex,   getItemCount,   getItems,   getMaximumItemAge,   getMaximumItemCount,   getNextTimePeriod,   getRangeDescription,   getTimePeriod,   getTimePeriodClass,   getTimePeriods,   getTimePeriodsUniqueToOtherSeries,   getValue,   getValue,   hashCode,   removeAgedItems,   removeAgedItems,   setDomainDescription,   setMaximumItemAge,   setMaximumItemCount,   setRangeDescription,   update,   update
Methods from org.jfree.data.general.Series:
addChangeListener,   addPropertyChangeListener,   clone,   equals,   firePropertyChange,   fireSeriesChanged,   getDescription,   getItemCount,   getKey,   getNotify,   hashCode,   isEmpty,   notifyListeners,   removeChangeListener,   removePropertyChangeListener,   setDescription,   setKey,   setNotify
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.jfree.data.time.TimeSeries Detail:
 public  void add(TimeSeriesDataItem item) 
 public  void add(TimeSeriesDataItem item,
    boolean notify) 
 public  void add(RegularTimePeriod period,
    double value) 
    Adds a new data item to the series and sends a SeriesChangeEvent to all registered listeners.
 public  void add(RegularTimePeriod period,
    Number value) 
 public  void add(RegularTimePeriod period,
    double value,
    boolean notify) 
    Adds a new data item to the series and sends a SeriesChangeEvent to all registered listeners.
 public  void add(RegularTimePeriod period,
    Number value,
    boolean notify) 
 public TimeSeries addAndOrUpdate(TimeSeries series) 
    Adds or updates data from one series to another. Returns another series containing the values that were overwritten.
 public TimeSeriesDataItem addOrUpdate(RegularTimePeriod period,
    double value) 
 public TimeSeriesDataItem addOrUpdate(RegularTimePeriod period,
    Number value) 
 public  void clear() 
    Removes all data items from the series and sends a SeriesChangeEvent to all registered listeners.
 public Object clone() throws CloneNotSupportedException 
    Returns a clone of the time series.

    Notes:

    • no need to clone the domain and range descriptions, since String object is immutable;
    • we pass over to the more general method clone(start, end).
 public TimeSeries createCopy(int start,
    int end) throws CloneNotSupportedException 
    Creates a new timeseries by copying a subset of the data in this time series.
 public TimeSeries createCopy(RegularTimePeriod start,
    RegularTimePeriod end) throws CloneNotSupportedException 
    Creates a new timeseries by copying a subset of the data in this time series.
 public  void delete(RegularTimePeriod period) 
    Deletes the data item for the given time period and sends a SeriesChangeEvent to all registered listeners. If there is no item with the specified time period, this method does nothing.
 public  void delete(int start,
    int end) 
    Deletes data from start until end index (end inclusive).
 public boolean equals(Object object) 
    Tests the series for equality with an arbitrary object.
 public TimeSeriesDataItem getDataItem(int index) 
    Returns a data item for the series.
 public TimeSeriesDataItem getDataItem(RegularTimePeriod period) 
    Returns the data item for a specific period.
 public String getDomainDescription() 
    Returns the domain description.
 public int getIndex(RegularTimePeriod period) 
    Returns the index for the item (if any) that corresponds to a time period.
 public int getItemCount() 
    Returns the number of items in the series.
 public List getItems() 
    Returns the list of data items for the series (the list contains TimeSeriesDataItem objects and is unmodifiable).
 public long getMaximumItemAge() 
    Returns the maximum item age (in time periods) for the series.
 public int getMaximumItemCount() 
    Returns the maximum number of items that will be retained in the series. The default value is Integer.MAX_VALUE.
 public RegularTimePeriod getNextTimePeriod() 
    Returns a time period that would be the next in sequence on the end of the time series.
 public String getRangeDescription() 
    Returns the range description.
 public RegularTimePeriod getTimePeriod(int index) 
    Returns the time period at the specified index.
 public Class getTimePeriodClass() 
    Returns the time period class for this series.

    Only one time period class can be used within a single series (enforced). If you add a data item with a Year for the time period, then all subsequent data items must also have a Year for the time period.

 public Collection getTimePeriods() 
    Returns a collection of all the time periods in the time series.
 public Collection getTimePeriodsUniqueToOtherSeries(TimeSeries series) 
    Returns a collection of time periods in the specified series, but not in this series, and therefore unique to the specified series.
 public Number getValue(int index) 
    Returns the value at the specified index.
 public Number getValue(RegularTimePeriod period) 
    Returns the value for a time period. If there is no data item with the specified period, this method will return null.
 public int hashCode() 
    Returns a hash code value for the object.
 public  void removeAgedItems(boolean notify) 
    Age items in the series. Ensure that the timespan from the youngest to the oldest record in the series does not exceed maximumItemAge time periods. Oldest items will be removed if required.
 public  void removeAgedItems(long latest,
    boolean notify) 
    Age items in the series. Ensure that the timespan from the supplied time to the oldest record in the series does not exceed history count. oldest items will be removed if required.
 public  void setDomainDescription(String description) 
    Sets the domain description and sends a PropertyChangeEvent (with the property name Domain) to all registered property change listeners.
 public  void setMaximumItemAge(long periods) 
    Sets the number of time units in the 'history' for the series. This provides one mechanism for automatically dropping old data from the time series. For example, if a series contains daily data, you might set the history count to 30. Then, when you add a new data item, all data items more than 30 days older than the latest value are automatically dropped from the series.
 public  void setMaximumItemCount(int maximum) 
    Sets the maximum number of items that will be retained in the series. If you add a new item to the series such that the number of items will exceed the maximum item count, then the FIRST element in the series is automatically removed, ensuring that the maximum item count is not exceeded.
 public  void setRangeDescription(String description) 
    Sets the range description and sends a PropertyChangeEvent (with the property name Range) to all registered listeners.
 public  void update(RegularTimePeriod period,
    Number value) 
    Updates (changes) the value for a time period. Throws a SeriesException if the period does not exist.
 public  void update(int index,
    Number value) 
    Updates (changes) the value of a data item.