Class AbstractDataProvider
java.lang.Object
org.eclipse.nebula.visualization.xygraph.dataprovider.AbstractDataProvider
- All Implemented Interfaces:
IDataProvider
- Direct Known Subclasses:
CircularBufferDataProvider
public abstract class AbstractDataProvider extends java.lang.Object implements IDataProvider
This gives the most common implementation of the
IDataProvider
interface.-
Field Summary
Fields Modifier and Type Field Description protected boolean
chronological
protected java.util.List<IDataProviderListener>
listeners
protected Range
xDataMinMax
protected Range
yDataMinMax
-
Constructor Summary
Constructors Constructor Description AbstractDataProvider(boolean chronological)
-
Method Summary
Modifier and Type Method Description void
addDataProviderListener(IDataProviderListener listener)
Add listenerprotected void
fireDataChange()
a data change has occuredRange
getDataRange(boolean positiveOnly, boolean isAxis)
Returns an updated range whenever data changed, for the XAxis or YAxis, with positive data only or not.Range
getDataRange(boolean positiveOnly, boolean isXAxis, int lowerBound)
Returns an updated range whenever data changed, for the XAxis or YAxis, with positive data only or not.abstract ISample
getSample(int index)
Get sample by indexabstract int
getSize()
Total number of samples.Range
getXDataMinMax()
Get the minimum and maximum xdata.Range
getXDataMinMax(boolean positiveOnly)
Get the minimum and maximum xdata.Range
getYDataMinMax()
Get the minimum and maximum ydata.Range
getYDataMinMax(boolean positiveOnly)
Get the minimum and maximum ydata.boolean
isChronological()
boolean
removeDataProviderListener(IDataProviderListener listener)
Remove listenervoid
setChronological(boolean chronological)
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
-
Field Details
-
chronological
protected boolean chronological -
listeners
-
xDataMinMax
-
yDataMinMax
-
-
Constructor Details
-
AbstractDataProvider
public AbstractDataProvider(boolean chronological)- Parameters:
trace
- the trace which the data provider will provide data to.chronological
- true if the data is sorted chronologically on xAxis, which means the data is sorted on X Axis.
-
-
Method Details
-
getSize
public abstract int getSize()Description copied from interface:IDataProvider
Total number of samples.- Specified by:
getSize
in interfaceIDataProvider
- Returns:
- size
- See Also:
IDataProvider.getSample(int)
-
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
- Parameters:
index
-- Returns:
- the ISample element at the given index
-
getXDataMinMax
Description copied from interface:IDataProvider
Get the minimum and maximum xdata.- Specified by:
getXDataMinMax
in interfaceIDataProvider
- Returns:
- a range includes the min and max as lower and upper. return null if there is no data.
-
getYDataMinMax
Description copied from interface:IDataProvider
Get the minimum and maximum ydata.- Specified by:
getYDataMinMax
in interfaceIDataProvider
- Returns:
- a range includes the min and max as lower and upper. return null if there is no data.
-
getXDataMinMax
Description copied from interface:IDataProvider
Get the minimum and maximum xdata.- Specified by:
getXDataMinMax
in interfaceIDataProvider
- Parameters:
positiveOnly
- if true, return values greater than zero- Returns:
- a range includes the min and max as lower and upper. return null if there is no data.
-
getYDataMinMax
Description copied from interface:IDataProvider
Get the minimum and maximum ydata.- Specified by:
getYDataMinMax
in interfaceIDataProvider
- Parameters:
positiveOnly
- if true, return values greater than zero- Returns:
- a range includes the min and max as lower and upper. return null if there is no data.
-
getDataRange
Returns an updated range whenever data changed, for the XAxis or YAxis, with positive data only or not.- Parameters:
positiveOnly
- if data is positive only (for log scale mode)isXAxis
-isXAxis
- if true, then this will return the updated range for the XAxis, YAxis otherwise
-
getDataRange
Returns an updated range whenever data changed, for the XAxis or YAxis, with positive data only or not.- Parameters:
positiveOnly
- if data is positive only (for log scale mode)isXAxis
- if true, then this will return the updated range for the XAxis, YAxis otherwiselowerBound
- by default it should be 0
-
setChronological
public void setChronological(boolean chronological)- Parameters:
chronological
- the chronological to set
-
isChronological
public boolean isChronological()- Specified by:
isChronological
in interfaceIDataProvider
- Returns:
- true if the order is chronological
-
addDataProviderListener
Add listener- Specified by:
addDataProviderListener
in interfaceIDataProvider
- Parameters:
listener
-
-
removeDataProviderListener
Remove listener- Specified by:
removeDataProviderListener
in interfaceIDataProvider
- Parameters:
listener
-- Returns:
- true if this list contained the specified element
-
fireDataChange
protected void fireDataChange()a data change has occured
-