public abstract class AbstractDataProvider extends java.lang.Object implements IDataProvider
IDataProvider
interface.Modifier and Type | Field and Description |
---|---|
protected boolean |
chronological |
protected java.util.List<IDataProviderListener> |
listeners |
protected Range |
xDataMinMax |
protected Range |
yDataMinMax |
Constructor and Description |
---|
AbstractDataProvider(boolean chronological) |
Modifier and Type | Method and Description |
---|---|
void |
addDataProviderListener(IDataProviderListener listener)
Add listener
|
protected void |
fireDataChange()
a data change has occured
|
Range |
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 index
|
abstract 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 listener
|
void |
setChronological(boolean chronological) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
hasErrors
protected boolean chronological
protected java.util.List<IDataProviderListener> listeners
protected Range xDataMinMax
protected Range yDataMinMax
public AbstractDataProvider(boolean chronological)
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.public abstract int getSize()
IDataProvider
getSize
in interface IDataProvider
IDataProvider.getSample(int)
public abstract 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
index
- public Range getXDataMinMax()
IDataProvider
getXDataMinMax
in interface IDataProvider
public Range getYDataMinMax()
IDataProvider
getYDataMinMax
in interface IDataProvider
public Range getXDataMinMax(boolean positiveOnly)
IDataProvider
getXDataMinMax
in interface IDataProvider
positiveOnly
- if true, return values greater than zeropublic Range getYDataMinMax(boolean positiveOnly)
IDataProvider
getYDataMinMax
in interface IDataProvider
positiveOnly
- if true, return values greater than zeropublic Range getDataRange(boolean positiveOnly, boolean isAxis)
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 otherwisepublic Range getDataRange(boolean positiveOnly, boolean isXAxis, int lowerBound)
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 0public void setChronological(boolean chronological)
chronological
- the chronological to setpublic boolean isChronological()
isChronological
in interface IDataProvider
public void addDataProviderListener(IDataProviderListener listener)
addDataProviderListener
in interface IDataProvider
listener
- public boolean removeDataProviderListener(IDataProviderListener listener)
removeDataProviderListener
in interface IDataProvider
listener
- protected void fireDataChange()