Package org.jfree.data.gantt
Class TaskSeriesCollection
- java.lang.Object
-
- org.jfree.data.general.AbstractDataset
-
- org.jfree.data.general.AbstractSeriesDataset
-
- org.jfree.data.gantt.TaskSeriesCollection
-
- All Implemented Interfaces:
java.io.ObjectInputValidation
,java.io.Serializable
,java.lang.Cloneable
,java.util.EventListener
,PublicCloneable
,CategoryDataset
,IntervalCategoryDataset
,GanttCategoryDataset
,Dataset
,SeriesChangeListener
,SeriesDataset
,KeyedValues2D
,Values2D
public class TaskSeriesCollection extends AbstractSeriesDataset implements GanttCategoryDataset, java.lang.Cloneable, PublicCloneable, java.io.Serializable
A collection ofTaskSeries
objects. This class provides one implementation of theGanttCategoryDataset
interface.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List
data
Storage for the series.private java.util.List
keys
Storage for aggregate task keys (the task description is used as the key).private static long
serialVersionUID
For serialization.
-
Constructor Summary
Constructors Constructor Description TaskSeriesCollection()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(TaskSeries series)
Adds a series to the dataset and sends aDatasetChangeEvent
to all registered listeners.boolean
canEqual(java.lang.Object other)
Ensures symmetry between super/subclass implementations of equals.java.lang.Object
clone()
Returns an independent copy of this dataset.boolean
equals(java.lang.Object obj)
Tests this instance for equality with an arbitrary object.int
getColumnCount()
Returns the number of column in the dataset.int
getColumnIndex(java.lang.Comparable columnKey)
Returns the column index for a column key.java.lang.Comparable
getColumnKey(int index)
Returns a column key.java.util.List
getColumnKeys()
Returns a list of the column keys in the dataset.java.lang.Number
getEndValue(int row, int column)
Returns the end value for a task.java.lang.Number
getEndValue(int row, int column, int subinterval)
Returns the end value of a sub-interval for a given item.java.lang.Number
getEndValue(java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Returns the end value for a task.java.lang.Number
getEndValue(java.lang.Comparable rowKey, java.lang.Comparable columnKey, int subinterval)
Returns the end value of a sub-interval for a given item.java.lang.Number
getPercentComplete(int row, int column)
Returns the percent complete for a given item.java.lang.Number
getPercentComplete(int row, int column, int subinterval)
Returns the percentage complete value of a sub-interval for a given item.java.lang.Number
getPercentComplete(java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Returns the percent complete for a given item.java.lang.Number
getPercentComplete(java.lang.Comparable rowKey, java.lang.Comparable columnKey, int subinterval)
Returns the percentage complete value of a sub-interval for a given item.int
getRowCount()
Returns the number of rows (series) in the collection.int
getRowIndex(java.lang.Comparable rowKey)
Returns the row index for the given row key.java.lang.Comparable
getRowKey(int index)
Returns the key for a row.java.util.List
getRowKeys()
Returns the row keys.TaskSeries
getSeries(int series)
Returns a series from the collection.TaskSeries
getSeries(java.lang.Comparable key)
Returns a series from the collection.int
getSeriesCount()
Returns the number of series in the collection.java.lang.Comparable
getSeriesKey(int series)
Returns the name of a series.java.lang.Number
getStartValue(int row, int column)
Returns the start value for a task.java.lang.Number
getStartValue(int row, int column, int subinterval)
Returns the start value of a sub-interval for a given item.java.lang.Number
getStartValue(java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Returns the start value for a task.java.lang.Number
getStartValue(java.lang.Comparable rowKey, java.lang.Comparable columnKey, int subinterval)
Returns the start value of a sub-interval for a given item.int
getSubIntervalCount(int row, int column)
Returns the number of sub-intervals for a given item.int
getSubIntervalCount(java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Returns the number of sub-intervals for a given item.java.lang.Number
getValue(int row, int column)
Returns the value for a task.java.lang.Number
getValue(java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Returns the value for an item.int
hashCode()
private void
readObject(java.io.ObjectInputStream stream)
Provides serialization support.private void
refreshKeys()
Refreshes the keys.void
remove(int series)
Removes a series from the collection and sends aDatasetChangeEvent
to all registered listeners.void
remove(TaskSeries series)
Removes a series from the collection and sends aDatasetChangeEvent
to all registered listeners.void
removeAll()
Removes all the series from the collection and sends aDatasetChangeEvent
to all registered listeners.void
seriesChanged(SeriesChangeEvent event)
Called when a series belonging to the dataset changes.private void
writeObject(java.io.ObjectOutputStream stream)
Provides serialization support.-
Methods inherited from class org.jfree.data.general.AbstractSeriesDataset
indexOf
-
Methods inherited from class org.jfree.data.general.AbstractDataset
addChangeListener, fireDatasetChanged, getGroup, getNotify, hasListener, notifyListeners, removeChangeListener, setGroup, setNotify, validateObject
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jfree.data.general.Dataset
addChangeListener, getGroup, removeChangeListener, setGroup
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
For serialization.- See Also:
- Constant Field Values
-
keys
private java.util.List keys
Storage for aggregate task keys (the task description is used as the key).
-
data
private java.util.List data
Storage for the series.
-
-
Method Detail
-
getSeries
public TaskSeries getSeries(java.lang.Comparable key)
Returns a series from the collection.- Parameters:
key
- the series key (null
not permitted).- Returns:
- The series.
-
getSeries
public TaskSeries getSeries(int series)
Returns a series from the collection.- Parameters:
series
- the series index (zero-based).- Returns:
- The series.
-
getSeriesCount
public int getSeriesCount()
Returns the number of series in the collection.- Specified by:
getSeriesCount
in interfaceSeriesDataset
- Specified by:
getSeriesCount
in classAbstractSeriesDataset
- Returns:
- The series count.
-
getSeriesKey
public java.lang.Comparable getSeriesKey(int series)
Returns the name of a series.- Specified by:
getSeriesKey
in interfaceSeriesDataset
- Specified by:
getSeriesKey
in classAbstractSeriesDataset
- Parameters:
series
- the series index (zero-based).- Returns:
- The name of a series.
-
getRowCount
public int getRowCount()
Returns the number of rows (series) in the collection.- Specified by:
getRowCount
in interfaceValues2D
- Returns:
- The series count.
-
getRowKeys
public java.util.List getRowKeys()
Returns the row keys. In this case, each series is a key.- Specified by:
getRowKeys
in interfaceKeyedValues2D
- Returns:
- The row keys.
-
getColumnCount
public int getColumnCount()
Returns the number of column in the dataset.- Specified by:
getColumnCount
in interfaceValues2D
- Returns:
- The column count.
-
getColumnKeys
public java.util.List getColumnKeys()
Returns a list of the column keys in the dataset.- Specified by:
getColumnKeys
in interfaceKeyedValues2D
- Returns:
- The category list.
-
getColumnKey
public java.lang.Comparable getColumnKey(int index)
Returns a column key.- Specified by:
getColumnKey
in interfaceKeyedValues2D
- Parameters:
index
- the column index.- Returns:
- The column key.
-
getColumnIndex
public int getColumnIndex(java.lang.Comparable columnKey)
Returns the column index for a column key.- Specified by:
getColumnIndex
in interfaceKeyedValues2D
- Parameters:
columnKey
- the column key (null
not permitted).- Returns:
- The column index.
-
getRowIndex
public int getRowIndex(java.lang.Comparable rowKey)
Returns the row index for the given row key.- Specified by:
getRowIndex
in interfaceKeyedValues2D
- Parameters:
rowKey
- the row key.- Returns:
- The index.
-
getRowKey
public java.lang.Comparable getRowKey(int index)
Returns the key for a row.- Specified by:
getRowKey
in interfaceKeyedValues2D
- Parameters:
index
- the row index (zero-based).- Returns:
- The key.
-
add
public void add(TaskSeries series)
Adds a series to the dataset and sends aDatasetChangeEvent
to all registered listeners.- Parameters:
series
- the series (null
not permitted).
-
remove
public void remove(TaskSeries series)
Removes a series from the collection and sends aDatasetChangeEvent
to all registered listeners.- Parameters:
series
- the series.
-
remove
public void remove(int series)
Removes a series from the collection and sends aDatasetChangeEvent
to all registered listeners.- Parameters:
series
- the series (zero based index).
-
removeAll
public void removeAll()
Removes all the series from the collection and sends aDatasetChangeEvent
to all registered listeners.
-
getValue
public java.lang.Number getValue(java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Returns the value for an item.- Specified by:
getValue
in interfaceKeyedValues2D
- Parameters:
rowKey
- the row key.columnKey
- the column key.- Returns:
- The item value.
-
getValue
public java.lang.Number getValue(int row, int column)
Returns the value for a task.
-
getStartValue
public java.lang.Number getStartValue(java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Returns the start value for a task. This is a date/time value, measured in milliseconds since 1-Jan-1970.- Specified by:
getStartValue
in interfaceIntervalCategoryDataset
- Parameters:
rowKey
- the series.columnKey
- the category.- Returns:
- The start value (possibly
null
). - See Also:
IntervalCategoryDataset.getEndValue(Comparable, Comparable)
-
getStartValue
public java.lang.Number getStartValue(int row, int column)
Returns the start value for a task.- Specified by:
getStartValue
in interfaceIntervalCategoryDataset
- Parameters:
row
- the row index (zero-based).column
- the column index (zero-based).- Returns:
- The start value.
- See Also:
IntervalCategoryDataset.getEndValue(int, int)
-
getEndValue
public java.lang.Number getEndValue(java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Returns the end value for a task. This is a date/time value, measured in milliseconds since 1-Jan-1970.- Specified by:
getEndValue
in interfaceIntervalCategoryDataset
- Parameters:
rowKey
- the series.columnKey
- the category.- Returns:
- The end value (possibly
null
). - See Also:
IntervalCategoryDataset.getStartValue(Comparable, Comparable)
-
getEndValue
public java.lang.Number getEndValue(int row, int column)
Returns the end value for a task.- Specified by:
getEndValue
in interfaceIntervalCategoryDataset
- Parameters:
row
- the row index (zero-based).column
- the column index (zero-based).- Returns:
- The end value.
- See Also:
IntervalCategoryDataset.getStartValue(int, int)
-
getPercentComplete
public java.lang.Number getPercentComplete(int row, int column)
Returns the percent complete for a given item.- Specified by:
getPercentComplete
in interfaceGanttCategoryDataset
- Parameters:
row
- the row index (zero-based).column
- the column index (zero-based).- Returns:
- The percent complete (possibly
null
). - See Also:
GanttCategoryDataset.getPercentComplete(Comparable, Comparable)
-
getPercentComplete
public java.lang.Number getPercentComplete(java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Returns the percent complete for a given item.- Specified by:
getPercentComplete
in interfaceGanttCategoryDataset
- Parameters:
rowKey
- the row key.columnKey
- the column key.- Returns:
- The percent complete.
- See Also:
GanttCategoryDataset.getPercentComplete(int, int)
-
getSubIntervalCount
public int getSubIntervalCount(int row, int column)
Returns the number of sub-intervals for a given item.- Specified by:
getSubIntervalCount
in interfaceGanttCategoryDataset
- Parameters:
row
- the row index (zero-based).column
- the column index (zero-based).- Returns:
- The sub-interval count.
- See Also:
GanttCategoryDataset.getSubIntervalCount(Comparable, Comparable)
-
getSubIntervalCount
public int getSubIntervalCount(java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Returns the number of sub-intervals for a given item.- Specified by:
getSubIntervalCount
in interfaceGanttCategoryDataset
- Parameters:
rowKey
- the row key.columnKey
- the column key.- Returns:
- The sub-interval count.
- See Also:
GanttCategoryDataset.getSubIntervalCount(int, int)
-
getStartValue
public java.lang.Number getStartValue(int row, int column, int subinterval)
Returns the start value of a sub-interval for a given item.- Specified by:
getStartValue
in interfaceGanttCategoryDataset
- Parameters:
row
- the row index (zero-based).column
- the column index (zero-based).subinterval
- the sub-interval index (zero-based).- Returns:
- The start value (possibly
null
). - See Also:
GanttCategoryDataset.getEndValue(int, int, int)
-
getStartValue
public java.lang.Number getStartValue(java.lang.Comparable rowKey, java.lang.Comparable columnKey, int subinterval)
Returns the start value of a sub-interval for a given item.- Specified by:
getStartValue
in interfaceGanttCategoryDataset
- Parameters:
rowKey
- the row key.columnKey
- the column key.subinterval
- the subinterval.- Returns:
- The start value (possibly
null
). - See Also:
GanttCategoryDataset.getEndValue(Comparable, Comparable, int)
-
getEndValue
public java.lang.Number getEndValue(int row, int column, int subinterval)
Returns the end value of a sub-interval for a given item.- Specified by:
getEndValue
in interfaceGanttCategoryDataset
- Parameters:
row
- the row index (zero-based).column
- the column index (zero-based).subinterval
- the subinterval.- Returns:
- The end value (possibly
null
). - See Also:
GanttCategoryDataset.getStartValue(int, int, int)
-
getEndValue
public java.lang.Number getEndValue(java.lang.Comparable rowKey, java.lang.Comparable columnKey, int subinterval)
Returns the end value of a sub-interval for a given item.- Specified by:
getEndValue
in interfaceGanttCategoryDataset
- Parameters:
rowKey
- the row key.columnKey
- the column key.subinterval
- the subinterval.- Returns:
- The end value (possibly
null
). - See Also:
GanttCategoryDataset.getStartValue(Comparable, Comparable, int)
-
getPercentComplete
public java.lang.Number getPercentComplete(int row, int column, int subinterval)
Returns the percentage complete value of a sub-interval for a given item.- Specified by:
getPercentComplete
in interfaceGanttCategoryDataset
- Parameters:
row
- the row index (zero-based).column
- the column index (zero-based).subinterval
- the sub-interval.- Returns:
- The percent complete value (possibly
null
). - See Also:
GanttCategoryDataset.getPercentComplete(Comparable, Comparable, int)
-
getPercentComplete
public java.lang.Number getPercentComplete(java.lang.Comparable rowKey, java.lang.Comparable columnKey, int subinterval)
Returns the percentage complete value of a sub-interval for a given item.- Specified by:
getPercentComplete
in interfaceGanttCategoryDataset
- Parameters:
rowKey
- the row key.columnKey
- the column key.subinterval
- the sub-interval.- Returns:
- The percent complete value (possibly
null
). - See Also:
GanttCategoryDataset.getPercentComplete(int, int, int)
-
seriesChanged
public void seriesChanged(SeriesChangeEvent event)
Called when a series belonging to the dataset changes.- Specified by:
seriesChanged
in interfaceSeriesChangeListener
- Overrides:
seriesChanged
in classAbstractSeriesDataset
- Parameters:
event
- information about the change.
-
refreshKeys
private void refreshKeys()
Refreshes the keys.
-
equals
public boolean equals(java.lang.Object obj)
Tests this instance for equality with an arbitrary object.- Overrides:
equals
in classAbstractDataset
- Parameters:
obj
- the object (null
permitted).- Returns:
- A boolean.
-
canEqual
public boolean canEqual(java.lang.Object other)
Ensures symmetry between super/subclass implementations of equals. For more detail, see http://jqno.nl/equalsverifier/manual/inheritance.- Overrides:
canEqual
in classAbstractDataset
- Parameters:
other
- Object- Returns:
- true ONLY if the parameter is THIS class type
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classAbstractDataset
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
Returns an independent copy of this dataset.- Specified by:
clone
in interfacePublicCloneable
- Overrides:
clone
in classAbstractDataset
- Returns:
- A clone of the dataset.
- Throws:
java.lang.CloneNotSupportedException
- if there is some problem cloning the dataset.
-
writeObject
private void writeObject(java.io.ObjectOutputStream stream) throws java.io.IOException
Provides serialization support.- Parameters:
stream
- the output stream.- Throws:
java.io.IOException
- if there is an I/O error.
-
readObject
private void readObject(java.io.ObjectInputStream stream) throws java.io.IOException, java.lang.ClassNotFoundException
Provides serialization support.- Parameters:
stream
- the input stream.- Throws:
java.io.IOException
- if there is an I/O error.java.lang.ClassNotFoundException
- if there is a classpath problem.
-
-