Class CircularBufferDataProvider
java.lang.Object
org.eclipse.nebula.visualization.xygraph.dataprovider.AbstractDataProvider
org.eclipse.nebula.visualization.xygraph.dataprovider.CircularBufferDataProvider
- All Implemented Interfaces:
IDataProvider
- Direct Known Subclasses:
ClippedCircularBufferDataProvider
public class CircularBufferDataProvider extends AbstractDataProvider
Provides data to a trace.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CircularBufferDataProvider.PlotMode
static class
CircularBufferDataProvider.UpdateMode
-
Field Summary
Fields inherited from class org.eclipse.nebula.visualization.xygraph.dataprovider.AbstractDataProvider
chronological, listeners, xDataMinMax, yDataMinMax
-
Constructor Summary
Constructors Constructor Description CircularBufferDataProvider(boolean chronological)
-
Method Summary
Modifier and Type Method Description void
addSample(ISample sample)
void
clearTrace()
Clear all data on in the data provider.protected void
fireDataChange()
a data change has occuredISample
getSample(int index)
Get sample by indexint
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 YDatavoid
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 usesetCurrentYData(double, long)
orsetCurrentYDataTimestamp(long)
to set the time stamp of ydata.void
triggerUpdate()
In TRIGGER update mode, the trace data could be updated by this methodMethods inherited from class org.eclipse.nebula.visualization.xygraph.dataprovider.AbstractDataProvider
addDataProviderListener, getDataRange, getDataRange, getXDataMinMax, getXDataMinMax, getYDataMinMax, getYDataMinMax, isChronological, removeDataProviderListener, setChronological
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.nebula.visualization.xygraph.dataprovider.IDataProvider
hasErrors
-
Constructor Details
-
CircularBufferDataProvider
public CircularBufferDataProvider(boolean chronological)
-
-
Method Details
-
setCurrentXData
public void setCurrentXData(double newValue)- Parameters:
currentXData
- the currentXData to set
-
setCurrentYData
public void setCurrentYData(double newValue)Set current YData. It will automatically make timestamp disabled.- Parameters:
currentYData
- the currentYData to set
-
addSample
-
setCurrentYDataTimestamp
public void setCurrentYDataTimestamp(long timestamp)Set the time stamp of currrent YData- Parameters:
timestamp
- timestamp of Y data in milliseconds.
-
setCurrentYData
public void setCurrentYData(double newValue, long timestamp)Set current YData and its timestamp when the new value generated.- Parameters:
currentYData
- the currentYData to settimestamp
- timestamp of Y data in milliseconds.
-
setCurrentXDataArray
public void setCurrentXDataArray(double[] newValue)- Parameters:
currentXData
- the currentXData to set
-
setCurrentYDataArray
public void setCurrentYDataArray(double[] newValue)- Parameters:
currentXData
- the currentXData to set
-
clearTrace
public void clearTrace()Clear all data on in the data provider. -
iterator
-
setBufferSize
public void setBufferSize(int bufferSize)- Parameters:
bufferSize
- the bufferSize to set
-
setUpdateMode
- Parameters:
updateMode
- the updateMode to set
-
getUpdateMode
- Returns:
- the update mode.
-
triggerUpdate
public void triggerUpdate()In TRIGGER update mode, the trace data could be updated by this method- Parameters:
triggerValue
- the triggerValue to set
-
setPlotMode
- Parameters:
plotMode
- the plotMode to set
-
getSample
Description copied from interface:IDataProvider
Get sample by indexSynchronization: Since the data might change dynamically,
synchronize
on theIDataProvider
around calls togetSize()
andgetSample()
.- Specified by:
getSample
in interfaceIDataProvider
- Specified by:
getSample
in classAbstractDataProvider
- Parameters:
index
- Sample index, 0...getSize()-1
- Returns:
- the ISample element at the given index
-
getSize
public int getSize()Description copied from interface:IDataProvider
Total number of samples.- Specified by:
getSize
in interfaceIDataProvider
- Specified by:
getSize
in classAbstractDataProvider
- Returns:
- size
- See Also:
IDataProvider.getSample(int)
-
setXAxisDateEnabled
public void setXAxisDateEnabled(boolean xAxisDateEnabled)If xAxisDateEnable is true, you will need to usesetCurrentYData(double, long)
orsetCurrentYDataTimestamp(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.- Parameters:
xAxisDateEnabled
- the xAxisDateEnabled to set
-
setUpdateDelay
public void setUpdateDelay(int updateDelay)- Parameters:
updateDelay
- Delay in milliseconds between plot updates. This may help to reduce CPU usage. The default value is 0ms.
-
fireDataChange
protected void fireDataChange()Description copied from class:AbstractDataProvider
a data change has occured- Overrides:
fireDataChange
in classAbstractDataProvider
-
setConcatenate_data
public void setConcatenate_data(boolean concatenate_data) -
isConcatenate_data
public boolean isConcatenate_data()
-