T
- the timestamp typepublic class GenericTimeTimeSeries<T extends Comparable<? super T>> extends Object implements UnivariateTimeSeries<T,UnivariateTimeSeries.Entry<T>>
UnivariateTimeSeries.Entry<T>
Constructor and Description |
---|
GenericTimeTimeSeries(T[] timestamps,
double[] values)
Construct a univariate time series from timestamps and values.
|
Modifier and Type | Method and Description |
---|---|
GenericTimeTimeSeries<T> |
diff(int d)
Construct an instance of
GenericTimeTimeSeries by taking the first difference
d times. |
GenericTimeTimeSeries<T> |
drop(int nItems)
Construct an instance of
GenericTimeTimeSeries by dropping the leading nItems
entries. |
boolean |
equals(Object obj) |
double |
get(int i)
Get the i-th value.
|
double |
get(T t)
Get the value at time
t . |
int |
hashCode() |
Iterator<UnivariateTimeSeries.Entry<T>> |
iterator() |
int |
size()
Get the length of the time series.
|
T |
time(int index)
Get the i-th time.
|
T[] |
timestamps()
Get all the timestamps.
|
double[] |
toArray()
Convert this time series into an array, discarding the timestamps.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
public GenericTimeTimeSeries(T[] timestamps, double[] values)
timestamps
- the timestampsvalues
- the valuespublic int size()
TimeSeries
size
in interface TimeSeries<T extends Comparable<? super T>,Double,UnivariateTimeSeries.Entry<T extends Comparable<? super T>>>
public Iterator<UnivariateTimeSeries.Entry<T>> iterator()
iterator
in interface Iterable<UnivariateTimeSeries.Entry<T extends Comparable<? super T>>>
public double[] toArray()
UnivariateTimeSeries
toArray
in interface UnivariateTimeSeries<T extends Comparable<? super T>,UnivariateTimeSeries.Entry<T extends Comparable<? super T>>>
public double get(int i)
i
- the position indexpublic double get(T t)
t
.t
- a timestampt
public T time(int index)
index
- the position indexpublic T[] timestamps()
public GenericTimeTimeSeries<T> drop(int nItems)
GenericTimeTimeSeries
by dropping the leading nItems
entries.nItems
- the number of leading entries to be droppedGenericTimeTimeSeries
public GenericTimeTimeSeries<T> diff(int d)
GenericTimeTimeSeries
by taking the first difference
d
times.d
- the number of differencesdiff(x, lag = 1, differences = d)
as in DoubleUtilsCopyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.