T
- the class of the elements of the underlying time seriespublic class UpdatableSeriesImpl<T> extends SeriesImpl<T> implements UpdatableSeries<T>
UpdatableSeries
.Constructor and Description |
---|
UpdatableSeriesImpl(Chronicle chronicle,
String name,
int number,
Surrogate surrogate)
Construct an
UpdatableSeries . |
Modifier and Type | Method and Description |
---|---|
void |
applyUpdates()
Apply pending updates.
|
void |
destroy()
Destroy the series.
|
UpdatableSeries<T> |
edit()
Return an
UpdatableSeries corresponding to this series. |
ch.agent.t2.timeseries.Observation<T> |
getFirstObservation(ch.agent.t2.time.TimeIndex time)
Return the observation at the given time index or the first following
observation.
|
ch.agent.t2.timeseries.Observation<T> |
getLastObservation(ch.agent.t2.time.TimeIndex time)
Return the observation at the give time index or the last preceding
observation.
|
ch.agent.t2.time.Range |
getRange()
Return the range of values.
|
ch.agent.t2.timeseries.TimeAddressable<T> |
getValues(ch.agent.t2.time.Range reqRange)
Return the time series of values in the range specified.
|
void |
scanValue(ch.agent.t2.time.TimeIndex t,
Object value)
Add a value to the list of pending updates.
|
boolean |
setRange(ch.agent.t2.time.Range range)
Set the range of the series.
|
void |
setValue(ch.agent.t2.time.TimeIndex t,
T value)
Add a value to the list of pending updates.
|
void |
setValues(ch.agent.t2.timeseries.TimeAddressable<T> values)
Set the time series to the list of pending updates.
|
<S> UpdatableSeries<S> |
typeCheck(Class<S> type)
Cast the series to the type specified.
|
protected void |
update()
Refresh state.
|
getAttribute, getAttributes, getChronicle, getDefinition, getDescription, getDescriptions, getName, getNames, getNumber, getTimeDomain, getValue, getValues, getValueType, isSparse, toString
equals, getDatabase, getId, getSurrogate, hashCode, inConstruction, isValid
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getAttribute, getAttributes, getChronicle, getDefinition, getDescription, getDescriptions, getName, getNames, getNumber, getTimeDomain, getValue, getValues, getValueType, isSparse
getDatabase, getId, getSurrogate, inConstruction, isValid
public UpdatableSeriesImpl(Chronicle chronicle, String name, int number, Surrogate surrogate)
UpdatableSeries
.chronicle
- a chroniclename
- a stringnumber
- a positive numbersurrogate
- a surrogatepublic UpdatableSeries<T> edit()
SeriesImpl
UpdatableSeries
corresponding to this series.
Successfully getting an Updatable
object does not imply
that updates can be successfully applied.
The new and old objects share internal data.
public <S> UpdatableSeries<S> typeCheck(Class<S> type) throws T2DBException
Series
typeCheck
in interface Series<T>
typeCheck
in interface UpdatableSeries<T>
typeCheck
in class SeriesImpl<T>
type
- the underlying type requiredT2DBException
public ch.agent.t2.timeseries.TimeAddressable<T> getValues(ch.agent.t2.time.Range reqRange) throws ch.agent.t2.T2Exception, T2DBException
The usage of a sparse time series for the result depends on the series
schema (SeriesDefinition.isSparse()
or on heuristics.
An updatable series always uses a sparse time series to ensure that arbitrary large gaps can be accommodated.
getValues
in interface Series<T>
getValues
in class SeriesImpl<T>
reqRange
- the range of values wanted or null for the full rangeT2DBException
ch.agent.t2.T2Exception
public ch.agent.t2.time.Range getRange() throws ch.agent.t2.T2Exception, T2DBException
Series
getRange
in interface Series<T>
getRange
in class SeriesImpl<T>
ch.agent.t2.T2Exception
T2DBException
public ch.agent.t2.timeseries.Observation<T> getLastObservation(ch.agent.t2.time.TimeIndex time) throws ch.agent.t2.T2Exception, T2DBException
Series
getLastObservation
in interface Series<T>
getLastObservation
in class SeriesImpl<T>
time
- a time index or nullT2DBException
ch.agent.t2.T2Exception
public ch.agent.t2.timeseries.Observation<T> getFirstObservation(ch.agent.t2.time.TimeIndex time) throws ch.agent.t2.T2Exception, T2DBException
Series
getFirstObservation
in interface Series<T>
getFirstObservation
in class SeriesImpl<T>
time
- a time index or nullT2DBException
ch.agent.t2.T2Exception
public void scanValue(ch.agent.t2.time.TimeIndex t, Object value) throws ch.agent.t2.T2Exception, T2DBException
UpdatableSeries
scanValue
in interface UpdatableSeries<T>
t
- a time indexvalue
- a valueT2DBException
ch.agent.t2.T2Exception
public void setValue(ch.agent.t2.time.TimeIndex t, T value) throws ch.agent.t2.T2Exception, T2DBException
UpdatableSeries
setValue
in interface UpdatableSeries<T>
t
- a time indexvalue
- a valueT2DBException
ch.agent.t2.T2Exception
public void setValues(ch.agent.t2.timeseries.TimeAddressable<T> values) throws ch.agent.t2.T2Exception, T2DBException
UpdatableSeries
setValues
in interface UpdatableSeries<T>
values
- a time series of valuesT2DBException
ch.agent.t2.T2Exception
public boolean setRange(ch.agent.t2.time.Range range) throws ch.agent.t2.T2Exception, T2DBException
UpdatableSeries
setRange
in interface UpdatableSeries<T>
range
- a range or null to clear the rangech.agent.t2.T2Exception
T2DBException
public void destroy() throws T2DBException
UpdatableSeries
destroy
in interface UpdatableSeries<T>
T2DBException
public void applyUpdates() throws T2DBException
Updatable
Database.commit()
and
Database.rollback()
is the client's responsibility.applyUpdates
in interface Updatable
T2DBException
protected void update()
SeriesImpl
update
in class SeriesImpl<T>
Copyright © 2017. All rights reserved.