Header
And More


org.jfree.data.time
Class TimePeriodValues

java.lang.Object
  extended by org.jfree.data.general.Series
      extended by org.jfree.data.time.TimePeriodValues
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class TimePeriodValues
extends Series
implements java.io.Serializable

A structure containing zero, one or many TimePeriodValue instances. The time periods can overlap, and are maintained in the order that they are added to the collection.

This is similar to the TimeSeries class, except that the time periods can have irregular lengths.

See Also:
Serialized Form

Field Summary
protected static java.lang.String DEFAULT_DOMAIN_DESCRIPTION
          Default value for the domain description.
protected static java.lang.String DEFAULT_RANGE_DESCRIPTION
          Default value for the range description.
 
Constructor Summary
TimePeriodValues(java.lang.String name)
          Creates a new (empty) collection of time period values.
TimePeriodValues(java.lang.String name, java.lang.String domain, java.lang.String range)
          Creates a new time series that contains no data.
 
Method Summary
 void add(TimePeriod period, double value)
          Adds a new data item to the series and sends a SeriesChangeEvent to all registered listeners.
 void add(TimePeriod period, java.lang.Number value)
          Adds a new data item to the series and sends a SeriesChangeEvent to all registered listeners.
 void add(TimePeriodValue item)
          Adds a data item to the series and sends a SeriesChangeEvent to all registered listeners.
 java.lang.Object clone()
          Returns a clone of the collection.
 TimePeriodValues createCopy(int start, int end)
          Creates a new instance by copying a subset of the data in this collection.
 void delete(int start, int end)
          Deletes data from start until end index (end inclusive) and sends a SeriesChangeEvent to all registered listeners.
 boolean equals(java.lang.Object obj)
          Tests the series for equality with another object.
 TimePeriodValue getDataItem(int index)
          Returns one data item for the series.
 java.lang.String getDomainDescription()
          Returns the domain description.
 int getItemCount()
          Returns the number of items in the series.
 int getMaxEndIndex()
          Returns the index of the time period with the maximum end milliseconds.
 int getMaxMiddleIndex()
          Returns the index of the time period with the maximum middle milliseconds.
 int getMaxStartIndex()
          Returns the index of the time period with the maximum start milliseconds.
 int getMinEndIndex()
          Returns the index of the time period with the minimum end milliseconds.
 int getMinMiddleIndex()
          Returns the index of the time period with the minimum middle milliseconds.
 int getMinStartIndex()
          Returns the index of the time period with the minimum start milliseconds.
 java.lang.String getRangeDescription()
          Returns the range description.
 TimePeriod getTimePeriod(int index)
          Returns the time period at the specified index.
 java.lang.Number getValue(int index)
          Returns the value at the specified index.
 int hashCode()
          Returns a hash code value for the object.
 void setDomainDescription(java.lang.String description)
          Sets the domain description and fires a property change event (with the property name Domain if the description changes).
 void setRangeDescription(java.lang.String description)
          Sets the range description and fires a property change event with the name Range.
 void update(int index, java.lang.Number value)
          Updates (changes) the value of a data item and sends a SeriesChangeEvent to all registered listeners.
 
Methods inherited from class org.jfree.data.general.Series
addChangeListener, addPropertyChangeListener, firePropertyChange, fireSeriesChanged, getDescription, getKey, getNotify, isEmpty, notifyListeners, removeChangeListener, removePropertyChangeListener, setDescription, setKey, setNotify
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DOMAIN_DESCRIPTION

protected static final java.lang.String DEFAULT_DOMAIN_DESCRIPTION
Default value for the domain description.

See Also:
Constant Field Values

DEFAULT_RANGE_DESCRIPTION

protected static final java.lang.String DEFAULT_RANGE_DESCRIPTION
Default value for the range description.

See Also:
Constant Field Values
Constructor Detail

TimePeriodValues

public TimePeriodValues(java.lang.String name)
Creates a new (empty) collection of time period values.

Parameters:
name - the name of the series (null not permitted).

TimePeriodValues

public TimePeriodValues(java.lang.String name,
                        java.lang.String domain,
                        java.lang.String range)
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.
range - the range description.
Method Detail

getDomainDescription

public java.lang.String getDomainDescription()
Returns the domain description.

Returns:
The domain description (possibly null).
See Also:
getRangeDescription(), setDomainDescription(String)

setDomainDescription

public void setDomainDescription(java.lang.String description)
Sets the domain description and fires a property change event (with the property name Domain if the description changes).

Parameters:
description - the new description (null permitted).
See Also:
getDomainDescription()

getRangeDescription

public java.lang.String getRangeDescription()
Returns the range description.

Returns:
The range description (possibly null).
See Also:
getDomainDescription(), setRangeDescription(String)

setRangeDescription

public void setRangeDescription(java.lang.String description)
Sets the range description and fires a property change event with the name Range.

Parameters:
description - the new description (null permitted).
See Also:
getRangeDescription()

getItemCount

public int getItemCount()
Returns the number of items in the series.

Specified by:
getItemCount in class Series
Returns:
The item count.

getDataItem

public TimePeriodValue getDataItem(int index)
Returns one data item for the series.

Parameters:
index - the item index (in the range 0 to getItemCount() - 1).
Returns:
One data item for the series.

getTimePeriod

public TimePeriod getTimePeriod(int index)
Returns the time period at the specified index.

Parameters:
index - the item index (in the range 0 to getItemCount() - 1).
Returns:
The time period at the specified index.
See Also:
getDataItem(int)

getValue

public java.lang.Number getValue(int index)
Returns the value at the specified index.

Parameters:
index - the item index (in the range 0 to getItemCount() - 1).
Returns:
The value at the specified index (possibly null).
See Also:
getDataItem(int)

add

public void add(TimePeriodValue item)
Adds a data item to the series and sends a SeriesChangeEvent to all registered listeners.

Parameters:
item - the item (null not permitted).

add

public void add(TimePeriod period,
                double value)
Adds a new data item to the series and sends a SeriesChangeEvent to all registered listeners.

Parameters:
period - the time period (null not permitted).
value - the value.
See Also:
add(TimePeriod, Number)

add

public void add(TimePeriod period,
                java.lang.Number value)
Adds a new data item to the series and sends a SeriesChangeEvent to all registered listeners.

Parameters:
period - the time period (null not permitted).
value - the value (null permitted).

update

public void update(int index,
                   java.lang.Number value)
Updates (changes) the value of a data item and sends a SeriesChangeEvent to all registered listeners.

Parameters:
index - the index of the data item to update.
value - the new value (null not permitted).

delete

public void delete(int start,
                   int end)
Deletes data from start until end index (end inclusive) and sends a SeriesChangeEvent to all registered listeners.

Parameters:
start - the index of the first period to delete.
end - the index of the last period to delete.

equals

public boolean equals(java.lang.Object obj)
Tests the series for equality with another object.

Overrides:
equals in class Series
Parameters:
obj - the object (null permitted).
Returns:
true or false.

hashCode

public int hashCode()
Returns a hash code value for the object.

Overrides:
hashCode in class Series
Returns:
The hashcode

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Returns a clone of the collection.

Notes:

Overrides:
clone in class Series
Returns:
A clone of the time series.
Throws:
java.lang.CloneNotSupportedException - if there is a cloning problem.

createCopy

public TimePeriodValues createCopy(int start,
                                   int end)
                            throws java.lang.CloneNotSupportedException
Creates a new instance by copying a subset of the data in this collection.

Parameters:
start - the index of the first item to copy.
end - the index of the last item to copy.
Returns:
A copy of a subset of the items.
Throws:
java.lang.CloneNotSupportedException - if there is a cloning problem.

getMinStartIndex

public int getMinStartIndex()
Returns the index of the time period with the minimum start milliseconds.

Returns:
The index.

getMaxStartIndex

public int getMaxStartIndex()
Returns the index of the time period with the maximum start milliseconds.

Returns:
The index.

getMinMiddleIndex

public int getMinMiddleIndex()
Returns the index of the time period with the minimum middle milliseconds.

Returns:
The index.

getMaxMiddleIndex

public int getMaxMiddleIndex()
Returns the index of the time period with the maximum middle milliseconds.

Returns:
The index.

getMinEndIndex

public int getMinEndIndex()
Returns the index of the time period with the minimum end milliseconds.

Returns:
The index.

getMaxEndIndex

public int getMaxEndIndex()
Returns the index of the time period with the maximum end milliseconds.

Returns:
The index.

Footer
And More


Copyright © 2000-2009 by Object Refinery Limited. All Rights Reserved.