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 theIDataProviderinterface.
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanchronologicalprotected java.util.List<IDataProviderListener>listenersprotected RangexDataMinMaxprotected RangeyDataMinMax
-
Constructor Summary
Constructors Constructor Description AbstractDataProvider(boolean chronological)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddDataProviderListener(IDataProviderListener listener)Add listenerprotected voidfireDataChange()a data change has occuredRangegetDataRange(boolean positiveOnly, boolean isAxis)Returns an updated range whenever data changed, for the XAxis or YAxis, with positive data only or not.RangegetDataRange(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 ISamplegetSample(int index)Get sample by indexabstract intgetSize()Total number of samples.RangegetXDataMinMax()Get the minimum and maximum xdata.RangegetXDataMinMax(boolean positiveOnly)Get the minimum and maximum xdata.RangegetYDataMinMax()Get the minimum and maximum ydata.RangegetYDataMinMax(boolean positiveOnly)Get the minimum and maximum ydata.booleanisChronological()booleanremoveDataProviderListener(IDataProviderListener listener)Remove listenervoidsetChronological(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 Detail
-
chronological
protected boolean chronological
-
listeners
protected java.util.List<IDataProviderListener> listeners
-
xDataMinMax
protected Range xDataMinMax
-
yDataMinMax
protected Range yDataMinMax
-
-
Method Detail
-
getSize
public abstract int getSize()
Description copied from interface:IDataProviderTotal number of samples.- Specified by:
getSizein interfaceIDataProvider- Returns:
- size
- See Also:
IDataProvider.getSample(int)
-
getSample
public abstract ISample getSample(int index)
Description copied from interface:IDataProviderGet sample by indexSynchronization: Since the data might change dynamically,
synchronizeon theIDataProvideraround calls togetSize()andgetSample().- Specified by:
getSamplein interfaceIDataProvider- Parameters:
index-- Returns:
- the ISample element at the given index
-
getXDataMinMax
public Range getXDataMinMax()
Description copied from interface:IDataProviderGet the minimum and maximum xdata.- Specified by:
getXDataMinMaxin interfaceIDataProvider- Returns:
- a range includes the min and max as lower and upper. return null if there is no data.
-
getYDataMinMax
public Range getYDataMinMax()
Description copied from interface:IDataProviderGet the minimum and maximum ydata.- Specified by:
getYDataMinMaxin interfaceIDataProvider- Returns:
- a range includes the min and max as lower and upper. return null if there is no data.
-
getXDataMinMax
public Range getXDataMinMax(boolean positiveOnly)
Description copied from interface:IDataProviderGet the minimum and maximum xdata.- Specified by:
getXDataMinMaxin 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
public Range getYDataMinMax(boolean positiveOnly)
Description copied from interface:IDataProviderGet the minimum and maximum ydata.- Specified by:
getYDataMinMaxin 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
public Range getDataRange(boolean positiveOnly, boolean isAxis)
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
public 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.- 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:
isChronologicalin interfaceIDataProvider- Returns:
- true if the order is chronological
-
addDataProviderListener
public void addDataProviderListener(IDataProviderListener listener)
Add listener- Specified by:
addDataProviderListenerin interfaceIDataProvider- Parameters:
listener-
-
removeDataProviderListener
public boolean removeDataProviderListener(IDataProviderListener listener)
Remove listener- Specified by:
removeDataProviderListenerin interfaceIDataProvider- Parameters:
listener-- Returns:
- true if this list contained the specified element
-
fireDataChange
protected void fireDataChange()
a data change has occured
-
-