Package net.sf.statcvs.reportmodel
Class TimeLine
- java.lang.Object
-
- net.sf.statcvs.reportmodel.TimeLine
-
public class TimeLine extends java.lang.Object
Contains time line data for an integer value. The semantics is that at every data point, the time line's value changed from the previous point's value to the current point's value. Time points may be specified either by an absolute value using addTimePoint, or by a value relative to the previous time point usingaddChange(java.util.Date, int)
. If all points are specified using addChange, an initial value must be given usingsetInitialValue(int)
.- Version:
- $Id: TimeLine.java,v 1.5 2008/04/02 11:52:02 benoitx Exp $
- Author:
- Richard Cyganiak
-
-
Constructor Summary
Constructors Constructor Description TimeLine(java.lang.String title, java.lang.String rangeLabel)
Creates a new time line.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChange(java.util.Date date, int delta)
Specifies that the time line's value changed at a given date.void
addTimePoint(java.util.Date date, int value)
Adds a data point to the time line.java.util.List
getDataPoints()
Returns a List of data points, ordered by date.java.lang.String
getRangeLabel()
Returns the range label (axis label) of the valuesjava.lang.String
getTitle()
Returns the title of the time lineboolean
isEmpty()
Checks if the time series is empty.void
setInitialValue(int initialValue)
Sets the initial value of the time line, that is the value just before the first data point.
-
-
-
Method Detail
-
setInitialValue
public void setInitialValue(int initialValue)
Sets the initial value of the time line, that is the value just before the first data point.- Parameters:
initialValue
- the time line's initial value
-
addTimePoint
public void addTimePoint(java.util.Date date, int value)
Adds a data point to the time line. Data points may be added in any order.- Parameters:
date
- the data point's datevalue
- the data point's value
-
addChange
public void addChange(java.util.Date date, int delta)
Specifies that the time line's value changed at a given date. Data points may be added in any order.- Parameters:
date
- the data point's datedelta
- the value change at this time
-
isEmpty
public boolean isEmpty()
Checks if the time series is empty. A series is considered empty if it has zero or one time points. It takes two distinct time points to actually make it a series.- Returns:
- true if the time series is empty
-
getDataPoints
public java.util.List getDataPoints()
Returns a List of data points, ordered by date.- Returns:
- a List of
TimePoint
s
-
getRangeLabel
public java.lang.String getRangeLabel()
Returns the range label (axis label) of the values- Returns:
- an axis label for the values
-
getTitle
public java.lang.String getTitle()
Returns the title of the time line- Returns:
- the title
-
-