@iotize/ionic
Version:
Iotize specific building blocks on top of @ionic/angular.
53 lines (52 loc) • 1.2 kB
TypeScript
/**
* Timeseries entry type
*/
export interface TimeseriesEntryType<TimeType, DataType> {
time: TimeType;
value: DataType;
}
/**
* Timeseries
*/
export interface TimeserieInterface<TimeType, DataType> {
/**
* return value as at index
*/
value(index: number): DataType;
/**
* Return time as at index
*/
time(index: number): TimeType;
/**
* Return all values as an array
*/
values(): DataType[];
/**
* Return all times as an array
*/
times(): TimeType[];
/**
* Return a sub timeseries with times in [start,end]
*/
timerange(start: TimeType, end: TimeType): TimeserieInterface<TimeType, DataType>;
/**
* Return timeserie size
*/
size(): number;
/**
* Add a value (sorted)
*/
add(time: TimeType, v: DataType): void;
/**
* Get timeseries element by index
*/
get(index: number): TimeseriesEntryType<TimeType, DataType>;
/**
* Transform the timeseries as an arra
*/
toArray(): Array<TimeseriesEntryType<TimeType, DataType>>;
/**
* Merging two timeseries
*/
merge(ts: TimeserieInterface<TimeType, DataType>): void;
}