public class DateSeriesBuilder extends Object
DateSeries instances. Example:
DateSeries ds = DateSeriesBuilder.builder().add(LocalDate.now(), 1).add(LocalDate.now().plusDays(1), 2).build();The resulting
DateSeries will be sorted by date regardless of the
order the points were added in.
Builder instances can be reused; it is safe to call
build multiple times to build multiple time
series. Each new series contains all the points of the ones created before
it.
| Constructor and Description |
|---|
DateSeriesBuilder()
Create a bulider with the default column names ("DATES" and "VALUES").
|
DateSeriesBuilder(String dateColumnName,
String valueColumnName)
Create a bulider with the specified column names.
|
| Modifier and Type | Method and Description |
|---|---|
DateSeriesBuilder |
add(int yyyymmdd,
double value)
Add a point to this time series.
|
DateSeriesBuilder |
add(int year,
int month,
int day,
double value)
Add a point to this time series.
|
DateSeriesBuilder |
add(LocalDate date,
double value)
Add a point to this time series.
|
DateSeries |
build()
Sorts the added points by date and returns a new
DateSeries. |
public DateSeriesBuilder()
public DateSeriesBuilder add(int year, int month, int day, double value)
year - - the yearmonth - - the month (1-based)day - - the day (1-based)value - - the valuepublic DateSeriesBuilder add(int yyyymmdd, double value)
yyyymmdd - - the date in yyyymmdd formatvalue - - the valuepublic DateSeriesBuilder add(LocalDate date, double value)
date - - the datevalue - - the valueNullPointerException - if date is nullpublic DateSeries build()
DateSeries.DateSeriesIllegalStateException - if the dates are not all distinctCopyright © 2020. All rights reserved.