public class SimpleMemoryStorage extends Object implements DataStorage
DataStorage first implementation which handles only memory.| Constructor and Description |
|---|
SimpleMemoryStorage() |
SimpleMemoryStorage(int chunkSize) |
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(DataStorageListener listener)
Adds a
DataStorageListener to be notified when data is lost. |
void |
clearAll() |
SortedSet<Data> |
getAvailableData(TimeInterval interval)
Returns all available
Data within the requested
TimeInterval. |
DataChunk |
getData(String channelName,
Timestamp from)
Read samples from source ordered by
Timestamp and starting with
the specified one. |
int |
getStoredSampleCount() |
boolean |
hasAvailableData(TimeInterval interval)
Returns
true if some data is available within the requested
interval, false otherwise. |
void |
removeListener(DataStorageListener listener)
Removes a
DataStorageListener. |
SortedSet<Data> |
storeData(DataChunk chunk)
|
public SimpleMemoryStorage()
public SimpleMemoryStorage(int chunkSize)
public DataChunk getData(String channelName, Timestamp from)
Timestamp and starting with
the specified one. Polled by DataRequestThread.getData in interface DataSourcechannelName - channel to read.from - lowest Timestamp of the first returned sample.DataChunk a chunk of ordered samples with all
Timestamp superior to the specified argument.public SortedSet<Data> getAvailableData(TimeInterval interval)
Data within the requested
TimeInterval.getAvailableData in interface DataStoragepublic boolean hasAvailableData(TimeInterval interval)
true if some data is available within the requested
interval, false otherwise.hasAvailableData in interface DataStoragepublic SortedSet<Data> storeData(DataChunk chunk)
Data of the specified DataChunk and returns
the corresponding set of Data ordered by Timestamp.storeData in interface DataStoragechunk - to store.Data ordered by Timestamp.public void addListener(DataStorageListener listener)
DataStorageListener to be notified when data is lost.addListener in interface DataStoragelistener - to be added.public void removeListener(DataStorageListener listener)
DataStorageListener.removeListener in interface DataStoragelistener - to be removedpublic int getStoredSampleCount()
public void clearAll()
clearAll in interface DataStorageCopyright © 2015. All rights reserved.