public class CircularBufferDataProvider extends AbstractDataProvider
Modifier and Type | Class and Description |
---|---|
static class |
CircularBufferDataProvider.PlotMode |
static class |
CircularBufferDataProvider.UpdateMode |
chronological, listeners, xDataMinMax, yDataMinMax
Constructor and Description |
---|
CircularBufferDataProvider(boolean chronological) |
Modifier and Type | Method and Description |
---|---|
void |
addSample(ISample sample) |
void |
clearTrace()
Clear all data on in the data provider.
|
protected void |
fireDataChange()
a data change has occured
|
ISample |
getSample(int index)
Get sample by index
|
int |
getSize()
Total number of samples.
|
CircularBufferDataProvider.UpdateMode |
getUpdateMode() |
boolean |
isConcatenate_data() |
java.util.Iterator<ISample> |
iterator() |
void |
setBufferSize(int bufferSize) |
void |
setConcatenate_data(boolean concatenate_data) |
void |
setCurrentXData(double newValue) |
void |
setCurrentXDataArray(double[] newValue) |
void |
setCurrentYData(double newValue)
Set current YData.
|
void |
setCurrentYData(double newValue,
long timestamp)
Set current YData and its timestamp when the new value generated.
|
void |
setCurrentYDataArray(double[] newValue) |
void |
setCurrentYDataTimestamp(long timestamp)
Set the time stamp of currrent YData
|
void |
setPlotMode(CircularBufferDataProvider.PlotMode plotMode) |
void |
setUpdateDelay(int updateDelay) |
void |
setUpdateMode(CircularBufferDataProvider.UpdateMode updateMode) |
void |
setXAxisDateEnabled(boolean xAxisDateEnabled)
If xAxisDateEnable is true, you will need to use
setCurrentYData(double, long) or
setCurrentYDataTimestamp(long) to set the time stamp of ydata. |
void |
triggerUpdate()
In TRIGGER update mode, the trace data could be updated by this method
|
addDataProviderListener, getDataRange, getDataRange, getXDataMinMax, getXDataMinMax, getYDataMinMax, getYDataMinMax, isChronological, removeDataProviderListener, setChronological
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
hasErrors
public CircularBufferDataProvider(boolean chronological)
public void setCurrentXData(double newValue)
currentXData
- the currentXData to setpublic void setCurrentYData(double newValue)
currentYData
- the currentYData to setpublic void addSample(ISample sample)
public void setCurrentYDataTimestamp(long timestamp)
timestamp
- timestamp of Y data in milliseconds.public void setCurrentYData(double newValue, long timestamp)
currentYData
- the currentYData to settimestamp
- timestamp of Y data in milliseconds.public void setCurrentXDataArray(double[] newValue)
currentXData
- the currentXData to setpublic void setCurrentYDataArray(double[] newValue)
currentXData
- the currentXData to setpublic void clearTrace()
public java.util.Iterator<ISample> iterator()
public void setBufferSize(int bufferSize)
bufferSize
- the bufferSize to setpublic void setUpdateMode(CircularBufferDataProvider.UpdateMode updateMode)
updateMode
- the updateMode to setpublic CircularBufferDataProvider.UpdateMode getUpdateMode()
public void triggerUpdate()
triggerValue
- the triggerValue to setpublic void setPlotMode(CircularBufferDataProvider.PlotMode plotMode)
plotMode
- the plotMode to setpublic ISample getSample(int index)
IDataProvider
Synchronization: Since the data might change dynamically,
synchronize
on the IDataProvider
around calls
to getSize()
and getSample()
.
getSample
in interface IDataProvider
getSample
in class AbstractDataProvider
index
- Sample index, 0...getSize()-1
public int getSize()
IDataProvider
getSize
in interface IDataProvider
getSize
in class AbstractDataProvider
IDataProvider.getSample(int)
public void setXAxisDateEnabled(boolean xAxisDateEnabled)
setCurrentYData(double, long)
or
setCurrentYDataTimestamp(long)
to set the time stamp of ydata.
This flag will be automatically enabled when either of these two methods
were called. The default value is false.xAxisDateEnabled
- the xAxisDateEnabled to setpublic void setUpdateDelay(int updateDelay)
updateDelay
- Delay in milliseconds between plot updates. This may help to
reduce CPU usage. The default value is 0ms.protected void fireDataChange()
AbstractDataProvider
fireDataChange
in class AbstractDataProvider
public void setConcatenate_data(boolean concatenate_data)
public boolean isConcatenate_data()