T - the value typepublic class RegularTimeSeries<T> extends AbstractTimeSeries<T> implements TimeIndexable<T>
TimeIndexable.
This implementation provides no synchronization.
The maximum allowed gap in a time series is by default 500. It can be set to another value using the system property "RegularTimeSeries.MaxGap".
| Modifier and Type | Class and Description |
|---|---|
class |
RegularTimeSeries.TimeSeriesIterator
TimeSeriesIterator is an
Iterator returning Observation objects. |
| Modifier and Type | Field and Description |
|---|---|
static String |
MAXGAP_PROPERTY |
| Constructor and Description |
|---|
RegularTimeSeries(Class<T> type,
TimeDomain domain)
Construct a regular time series.
|
RegularTimeSeries(Class<T> type,
TimeDomain domain,
T missingValue)
Construct a regular time series.
|
| Modifier and Type | Method and Description |
|---|---|
TimeIndexable<T> |
asIndexable()
Return an indexable time series corresponding to this one.
|
TimeIndexable<T> |
copy()
Return a copy of the time series.
|
int |
fill(Filler<T> interpolator)
Fill holes using the given procedure.
|
int |
fill(long tailLength)
Fill holes in the time series by repeating the last value before each
hole and append a tail by repeating the last value a given number of
times.
|
int |
fill(T replacement,
long tailLength)
Fill holes in the time series with the given value and append a
tail of the given length.
|
TimeAddressable<T> |
get(long first,
long last)
Return a new time series corresponding to the range between two numerical time indexes.
|
TimeAddressable<T> |
get(Range range)
Return a time series constructed from the given range of this series.
|
T[] |
getArray()
Return all the values in an array.
|
T[] |
getArray(Range range)
Return a subrange of values in an array.
|
int |
getMaxGap()
Return the maximum allowed length of a single run of missing values.
|
int |
getValueCount()
Return the number of non-missing values.
|
protected void |
internalClear()
Remove all values from the time series.
|
protected T |
internalGet(long index)
Get the value identified by the given numerical time index.
|
protected Collection<T> |
internalGetData()
Return all values as a
Collection. |
protected Observation<T> |
internalGetFirst(long index)
Return the observation at or after the given numerical time index.
|
protected long |
internalGetFirstIndex()
Return the numerical time index of the first element.
|
protected Observation<T> |
internalGetLast(long index)
Return the observation at or before the given numerical time index.
|
protected long |
internalGetLastIndex()
Return the numerical time index of the last element.
|
protected int |
internalGetSize()
Return the used size of the data structure where values are stored.
|
protected void |
internalPut(long index,
T value)
Put the value into the series at the given numerical time index.
|
protected void |
internalRemove(long index)
Remove the value at the given numerical time index.
|
protected void |
internalSetBounds(long first,
long last)
Shrink the range to the one given by the two numerical time indexes.
|
boolean |
isIndexable()
Return true if the time series implements
TimeIndexable. |
Iterator<Observation<T>> |
iterator()
Returns an iterator over the
Observations in the time series
ordered by increasing time index. |
TimeIndexable<T> |
makeEmptyCopy()
Make a copy of the time series but without the values.
|
void |
put(long index,
T[] values)
Put an array of values identified with the numerical time index of its
first element into the time series.
|
void |
put(TimeAddressable<T> values,
UpdateReviewer<T> reviewer)
Conditionally put all values from another time series into this time series.
|
accept, get, get, getFirst, getFirstIndex, getLast, getLastIndex, getMissingValue, getRange, getSize, getTimeDomain, getType, isMissing, make, normalizeMissingValue, put, put, put, remove, setRange, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitget, get, getFirst, getFirstIndex, getLast, getLastIndex, getMissingValue, getRange, getSize, getTimeDomain, getType, isMissing, put, put, put, remove, setRangeforEach, spliteratorpublic static final String MAXGAP_PROPERTY
public RegularTimeSeries(Class<T> type, TimeDomain domain, T missingValue)
type - a non-null data typedomain - a non-null time domainmissingValue - an object representing missing valuespublic RegularTimeSeries(Class<T> type, TimeDomain domain)
Double.NaN for type Double and null for all other types.type - a non-null data typedomain - a non-null time domainpublic Iterator<Observation<T>> iterator()
TimeIndexableObservations in the time series
ordered by increasing time index. In contrast to
TimeAddressable.iterator(), this iterator returns all missing
valuesiterator in interface TimeAddressable<T>iterator in interface TimeIndexable<T>iterator in interface Iterable<Observation<T>>public TimeAddressable<T> get(Range range) throws T2Exception
TimeAddressableget in interface TimeAddressable<T>range - a non-null rangeT2Exceptionpublic TimeAddressable<T> get(long first, long last) throws T2Exception
TimeAddressableget in interface TimeAddressable<T>get in class AbstractTimeSeries<T>first - a numerical time index giving the lower bound of the wanted rangelast - a numerical time index giving the upper bound of the wanted rangeT2Exceptionprotected Observation<T> internalGetLast(long index) throws T2Exception
AbstractTimeSeriesObservation, only a special rule for this method).internalGetLast in class AbstractTimeSeries<T>index - a numerical time indexT2Exceptionprotected Observation<T> internalGetFirst(long index) throws T2Exception
AbstractTimeSeriesObservation, only a special rule for this method).internalGetFirst in class AbstractTimeSeries<T>index - a numberT2Exceptionpublic int getValueCount()
TimeAddressablegetValueCount in interface TimeAddressable<T>public boolean isIndexable()
TimeAddressableTimeIndexable.isIndexable in interface TimeAddressable<T>public int getMaxGap()
TimeIndexablegetMaxGap in interface TimeIndexable<T>public TimeIndexable<T> makeEmptyCopy()
TimeAddressablemakeEmptyCopy in interface TimeAddressable<T>makeEmptyCopy in interface TimeIndexable<T>public TimeIndexable<T> asIndexable() throws T2Exception
TimeAddressableasIndexable in interface TimeAddressable<T>T2Exceptionpublic TimeIndexable<T> copy() throws T2Exception
TimeAddressablecopy in interface TimeAddressable<T>copy in interface TimeIndexable<T>copy in class AbstractTimeSeries<T>T2Exceptionpublic T[] getArray()
TimeIndexablegetArray in interface TimeIndexable<T>public T[] getArray(Range range) throws T2Exception
TimeIndexablegetArray in interface TimeIndexable<T>range - the non-null wanted rangeT2Exceptionpublic void put(long index,
T[] values)
throws T2Exception
TimeAddressableput in interface TimeAddressable<T>put in class AbstractTimeSeries<T>index - a numerical time indexvalues - a non-null array of valuesT2Exceptionpublic void put(TimeAddressable<T> values, UpdateReviewer<T> reviewer) throws T2Exception
TimeAddressable
Important note. When the implementation of the values time series
does not explicitly represent missing values (see SparseTimeSeries for example),
this method cannot be relied upon for "deleting" values of the target.
put in interface TimeAddressable<T>put in class AbstractTimeSeries<T>values - a non-null time seriesreviewer - a reviewerT2Exceptionpublic int fill(T replacement, long tailLength) throws T2Exception
TimeIndexableNote: the method can be used to count missing values by specify a missing value as replacement. In this case it is illegal to specify a positive tail length.
fill in interface TimeIndexable<T>replacement - the replacement valuetailLength - the length of the tail to appendT2Exceptionpublic int fill(long tailLength)
TimeIndexablefill in interface TimeIndexable<T>tailLength - the number of times the last value must be repeatedpublic int fill(Filler<T> interpolator) throws T2Exception
TimeIndexablefill in interface TimeIndexable<T>interpolator - a non-null fillerT2Exceptionprotected void internalClear()
AbstractTimeSeriesinternalClear in class AbstractTimeSeries<T>protected T internalGet(long index) throws T2Exception
AbstractTimeSeriesinternalGet in class AbstractTimeSeries<T>index - a numerical time indexT2Exceptionprotected Collection<T> internalGetData()
AbstractTimeSeriesCollection.internalGetData in class AbstractTimeSeries<T>protected long internalGetFirstIndex()
AbstractTimeSeriesinternalGetFirstIndex in class AbstractTimeSeries<T>protected long internalGetLastIndex()
AbstractTimeSeriesinternalGetLastIndex in class AbstractTimeSeries<T>protected int internalGetSize()
AbstractTimeSeriesinternalGetSize in class AbstractTimeSeries<T>protected void internalPut(long index,
T value)
throws T2Exception
AbstractTimeSeriesThe method silently ignores missing values added out of range. Adding missing values at the boundary shrinks the range.
internalPut in class AbstractTimeSeries<T>index - a numerical time indexvalue - a valueT2Exceptionprotected void internalRemove(long index)
throws T2Exception
AbstractTimeSeriesinternalRemove in class AbstractTimeSeries<T>index - a numerical time indexT2Exceptionprotected void internalSetBounds(long first,
long last)
throws T2Exception
AbstractTimeSeriesinternalSetBounds in class AbstractTimeSeries<T>first - a numerical time index giving the lower bound of the new rangelast - a numerical time index giving the upper bound of the new rangeT2ExceptionCopyright © 2017. All rights reserved.