|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.numericalmethod.suanshu.stats.timeseries.univariate.GenericTimeTimeSeries<T>
T - the Comparable typepublic class GenericTimeTimeSeries<T extends java.lang.Comparable<T>>
This is an implementation of a univariate time series indexed by some notion of time.
This implementation explicitly remembers all data in memory. It is appropriate for short time series.
GenericTimeTimeSeries is immutable.
| Nested Class Summary | |
|---|---|
class |
GenericTimeTimeSeries.Iterator
the Iterator used to read a GenericTimeTimeSeries |
| Nested classes/interfaces inherited from interface com.numericalmethod.suanshu.stats.timeseries.univariate.TimeSeries |
|---|
TimeSeries.Entry<T> |
| Constructor Summary | |
|---|---|
GenericTimeTimeSeries(T[] timestamps,
double[] values)
Construct a GenericTimeTimeSeries from an array of timestamps and an array of values. |
|
| Method Summary | |
|---|---|
GenericTimeTimeSeries<T> |
diff(int d)
Create a new and independent GenericTimeTimeSeries by taking the first difference. |
GenericTimeTimeSeries<T> |
drop(int nItems)
Create a new and independent GenericTimeTimeSeries by dropping the leading nItems entries,
the most backward in time entries. |
boolean |
equals(java.lang.Object obj)
|
double |
get(int index)
Get the value at position index. |
int |
hashCode()
|
GenericTimeTimeSeries.Iterator |
iterator()
Get an Iterator to read this univariate time series. |
int |
size()
the length of the time series |
T |
time(int index)
Get the time at position index. |
T[] |
timestamps()
Get all the timestamps. |
double[] |
toArray()
Convert this time series into an array. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public GenericTimeTimeSeries(T[] timestamps,
double[] values)
The two arrays must be of the same length.
timestamps - an array of timestampsvalues - an array of values| Method Detail |
|---|
public int size()
TimeSeries
size in interface TimeSeries<T extends java.lang.Comparable<T>,java.lang.Double>public GenericTimeTimeSeries.Iterator iterator()
TimeSeries
iterator in interface TimeSeries<T extends java.lang.Comparable<T>,java.lang.Double>public double[] toArray()
TimeSeries
public double get(int index)
index.
index - the position index
index-th valuepublic T time(int index)
index.
index - the position index
index-th timestamppublic T[] timestamps()
public GenericTimeTimeSeries<T> drop(int nItems)
nItems entries,
the most backward in time entries.
nItems - the number of leading entries to be dropped
public GenericTimeTimeSeries<T> diff(int d)
d - the number of differences
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object
|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||