net.sourceforge.openforecast.input
Class TimeSeriesBuilder
- java.lang.Object
-
- net.sourceforge.openforecast.input.AbstractBuilder
-
- net.sourceforge.openforecast.input.TimeSeriesBuilder
-
- All Implemented Interfaces:
- Builder
public class TimeSeriesBuilder extends AbstractBuilder
Defines a Builder that can be used to construct a DataSet from a TimeSeries object as used/defined by JFreeChart. This class makes for a quick and easy "import" of data from a JFreeChart TimeSeries. Note that since a TimeSeries does not give a name to the independent, time variable, this builder defaults the name to be the class name of the RegularTimePeriod used in the TimeSeries. For example, if a series of org.jfree.data.time.Day objects are used, then the name of the independent variable will default to "Day" (without the quotes).- Since:
- 0.4
-
-
Constructor Summary
Constructors Constructor and Description TimeSeriesBuilder(org.jfree.data.time.TimeSeries timeSeries)Constructs a new TimeSeriesBuilder that reads its input from the given TimeSeries object.TimeSeriesBuilder(org.jfree.data.time.TimeSeries timeSeries, java.lang.String timeVariableName)Constructs a new TimeSeriesBuilder that reads its input from the given TimeSeries object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description DataSetbuild()Retrieves a DataSet - a collection of DataPoints - from the current (JFreeChart) TimeSeries.java.lang.StringgetTimeVariable()Returns the name of the currently defined time variable.voidsetTimeVariable(java.lang.String name)Used to change the time variable name.
-
-
-
Constructor Detail
-
TimeSeriesBuilder
public TimeSeriesBuilder(org.jfree.data.time.TimeSeries timeSeries)
Constructs a new TimeSeriesBuilder that reads its input from the given TimeSeries object. This builder defaults the of the independent, time variable to be the class name of the RegularTimePeriod used in the TimeSeries. For example, if a series of org.jfree.data.time.Day objects are used, then the name of the independent variable will default to "Day" (without the quotes). See the class description for more information.- Parameters:
timeSeries- the TimeSeries object containing data to be used to build the DataSet.- Throws:
java.lang.IllegalArgumentException- if the TimeSeries is empty.
-
TimeSeriesBuilder
public TimeSeriesBuilder(org.jfree.data.time.TimeSeries timeSeries, java.lang.String timeVariableName)Constructs a new TimeSeriesBuilder that reads its input from the given TimeSeries object. This builder uses the given name for the independent, time variable in the DataPoints that are created.- Parameters:
timeSeries- the TimeSeries object containing data to be used to build the DataSet.timeVariableName- the name to use for the time variable.- Throws:
java.lang.IllegalArgumentException- if the TimeSeries is empty.
-
-
Method Detail
-
getTimeVariable
public java.lang.String getTimeVariable()
Returns the name of the currently defined time variable.- Returns:
- the name currently defined for the time variable.
-
setTimeVariable
public void setTimeVariable(java.lang.String name)
Used to change the time variable name.- Parameters:
name- the new name for the time variable.
-
build
public DataSet build()
Retrieves a DataSet - a collection of DataPoints - from the current (JFreeChart) TimeSeries. The DataSet should contain all DataPoints defined by the TimeSeries.In general, build will attempt to convert all values in the TimeSeries to data points.
- Returns:
- a DataSet built from the current TimeSeries.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG