public abstract class IlvAbstractDataSet extends Object implements IlvDataSet, IlvBatchable, Serializable
IlvDataSet
interface.
DataSetListener
listeners
and provides methods to generate and dispatch DataSetEvent
events.IlvDataSet
as a subclass of
IlvAbstractDataSet
, you must provide an implementation for
the following methods:
public abstract int getDataCount(); public abstract double getXData(int idx); public abstract double getYData(int idx);The resulting data set will be read-only, as
IlvAbstractDataSet
defines empty implementations for writing operations.Modifier and Type | Field and Description |
---|---|
static Double |
DEFAULT_UNDEF_VALUE
A default undefined value equal to
Double.MIN_VALUE . |
Modifier | Constructor and Description |
---|---|
protected |
IlvAbstractDataSet()
Creates a new
IlvAbstractDataSet . |
Modifier and Type | Method and Description |
---|---|
void |
addData(double x,
double y)
Adds a data point at the end of this data set.
|
void |
addDataSetListener(DataSetListener lst)
Adds the specified listener to receive events concerning changes
on this data set.
|
protected void |
computeLimits(IlvDataInterval xRange,
IlvDataInterval yRange)
Computes the limits of the values stored in this data set.
|
static double |
computeMinimumXDifference(IlvDataSet ds)
Computes the minimum positive difference among adjacent X values in the
sequence of X values, sorted into ascending order.
|
protected void |
dataAdded(int idx)
Called when a data point has been added.
|
protected void |
dataChanged(int firstIdx,
int lastIdx,
int eventType)
Called when data points have been modified.
|
void |
endBatch()
Terminates a batch of modifications.
|
void |
fireDataAddedEvent(int firstIdx,
int lastIdx)
Notifies the listeners that the data from
firstIdx
to lastIdx have been added to the data set. |
void |
fireDataChangedEvent(int firstIdx,
int lastIdx,
int eventType)
Notifies the listeners that a change of the given type occurred on
the data from
firstIdx to lastIdx . |
void |
fireDataSetContentsEvent(DataSetContentsEvent event)
Sends the specified content event to all the registered data set listeners.
|
void |
fireDataSetPropertyEvent(DataSetPropertyEvent event)
Sends the specified property event to all the registered data set listeners.
|
IlvDataPoints |
getData()
Returns all the data points held by this data set.
|
IlvDataPoints |
getDataBetween(int iMin,
int iMax)
Returns the data points between the two specified indices.
|
abstract int |
getDataCount()
Returns the number of data points held by this data set.
|
IlvDataPoints |
getDataInside(IlvDataWindow window,
int adjCount,
boolean continuous)
Returns the data points inside the specified data window.
|
protected IlvDataPoints |
getDataInside(IlvDataWindow window,
int iMin,
int iMax,
int adjCount,
boolean continuous)
Returns the data points of the specified index range inside the specified
data window.
|
String |
getDataLabel(int idx)
Returns the label associated with the data point at the specified index.
|
double |
getMinimumXDifference()
Returns the minimum positive difference among adjacent X values in the
sequence of X values, sorted into ascending order.
|
String |
getName()
Returns the name of this data set.
|
Object |
getProperty(Object key)
Returns the value of the given property.
|
Double |
getUndefValue()
Returns a value that is used to mark a data point as undefined.
|
abstract double |
getXData(int idx)
Returns the x-value of the data point at the specified index.
|
IlvDataInterval |
getXRange()
Returns the limits of the x-values handled by this data set.
|
IlvDataInterval |
getXRange(IlvDataInterval xRange)
Returns the limits of the x-values handled by this data set.
|
abstract double |
getYData(int idx)
Returns the y-value of the data point at the specified index.
|
IlvDataInterval |
getYRange()
Returns the limits of the y-values handled by this data set.
|
IlvDataInterval |
getYRange(IlvDataInterval yRange)
Returns the limits of the y-values handled by this data set.
|
void |
invalidateLimits()
Invalidates the entire x range and y range cache.
|
void |
invalidateLimits(int firstIdx,
int lastIdx)
Invalidates the x range cache and y range cache from index
firstIdx to index lastIdx (inclusive).
|
void |
invalidateLimits(int firstIdx,
int lastIdx,
boolean dataAdded)
Invalidates the x range cache and y range cache from index
firstIdx to index lastIdx (inclusive).
|
boolean |
isBatched()
Indicates whether notification events are batched.
|
boolean |
isEditable()
Indicates whether the data set is editable.
|
boolean |
isXRangeIncludingUndefinedPoints()
Returns true if points with an undefined y value are included when
computing the x range.
|
boolean |
isXValuesSorted()
Indicates whether the X values of the data points managed by
this data set are sorted into ascending order.
|
void |
putProperty(Object key,
Object value,
boolean notify)
Sets the given property on this data set.
|
void |
removeDataSetListener(DataSetListener lst)
Removes the specified listener from this data set.
|
void |
setData(int idx,
double x,
double y)
Modifies the data point at the specified index.
|
protected void |
setLimitsValid(boolean valid)
Deprecated.
Please use
invalidateLimits() or
invalidateLimits(int, int) instead of
setLimitsValid(false) . |
void |
setName(String name)
Sets the name of this data set.
|
void |
setUndefValue(Double undefValue)
Specifies the
undefined value for this data set. |
void |
setXRangeIncludingUndefinedPoints(boolean include)
Specifies whether points with an undefined y value are included when
computing the x range.
|
void |
startBatch()
Starts a batch of modifications.
|
String |
toString()
Returns a string representation of this data set.
|
public static final Double DEFAULT_UNDEF_VALUE
Double.MIN_VALUE
.setUndefValue(java.lang.Double)
protected IlvAbstractDataSet()
IlvAbstractDataSet
.public boolean isXRangeIncludingUndefinedPoints()
setXRangeIncludingUndefinedPoints(boolean)
public void setXRangeIncludingUndefinedPoints(boolean include)
include
- true
if such points are considered,
false
if they are ignored for the x range.isXRangeIncludingUndefinedPoints()
public IlvDataInterval getXRange()
getXRange(null)
.public IlvDataInterval getYRange()
getYRange(null)
.getYRange(IlvDataInterval)
public IlvDataInterval getXRange(IlvDataInterval xRange)
null
, a new
IlvDataInterval
is allocated.getXRange
in interface IlvDataSet
isXRangeIncludingUndefinedPoints()
public IlvDataInterval getYRange(IlvDataInterval yRange)
null
, a new
IlvDataInterval
is allocated.getYRange
in interface IlvDataSet
public final void invalidateLimits()
public final void invalidateLimits(int firstIdx, int lastIdx)
public final void invalidateLimits(int firstIdx, int lastIdx, boolean dataAdded)
firstIdx
- index of first added or changed data pointlastIdx
- index of last added or changed data pointdataAdded
- true
if data was added at the end,
false
otherwise.@Deprecated protected void setLimitsValid(boolean valid)
invalidateLimits()
or
invalidateLimits(int, int)
instead of
setLimitsValid(false)
.protected void computeLimits(IlvDataInterval xRange, IlvDataInterval yRange)
xRange
- Returns the x-values range.yRange
- Returns the y-values range.isXRangeIncludingUndefinedPoints()
public boolean isXValuesSorted()
isXValuesSorted()
is true
, the
particular IlvDataSet
implementation class guarantees
that for any two indices i and j such that
i < j,
getXData(i) <= getXData(j)
.
The default implementation returns false
.
Note that the spatial request implemented by the
getDataInside(ilog.views.chart.IlvDataWindow, int, boolean)
method is much more efficient
if the values are sorted.
isXValuesSorted
in interface IlvDataSet
public static double computeMinimumXDifference(IlvDataSet ds)
This function can be used to implement getMinimumXDifference()
for your own data sets.
public double getMinimumXDifference()
Note: This method may be slow, depending on the other characteristics of
this data set. If you want to provide this information, instead of having
it computed each time it is needed, you can do so by calling
IlvDataSetProperty.setCategory(IlvDataSet, Double)
.
public abstract int getDataCount()
getDataCount
in interface IlvDataSet
public abstract double getXData(int idx)
getXData
in interface IlvDataSet
idx
- a data point index, >= 0, < getDataCount()
public abstract double getYData(int idx)
getYData
in interface IlvDataSet
idx
- a data point index, >= 0, < getDataCount()
public void addData(double x, double y)
addData
in interface IlvDataSet
x
- the x coordinate of the new pointy
- the y coordinate of the new pointpublic void setData(int idx, double x, double y)
setData
in interface IlvDataSet
idx
- a data point index, >= 0, < getDataCount()
x
- the new x coordinate of the point (if this data set supports
setting arbitrary x values)y
- the new y coordinate of the pointpublic boolean isEditable()
isEditable
in interface IlvDataSet
false
, as IlvAbstractDataSet
provides
empty implementation for editing operations.public void setUndefValue(Double undefValue)
undefined value
for this data set.getUndefValue()
public Double getUndefValue()
null
, in which case it is assumed
that all undefined data in the data set is represented by NaN values.getUndefValue
in interface IlvDataSet
public void startBatch()
endBatch()
call.
The listeners are responsible for accumulating the events instead of
handling them immediately, if they wish to do so. The class
IlvBatchingDataSetListener
is a utility
class that helps doing so.
startBatch
in interface IlvBatchable
endBatch()
,
DataSetContentsEvent.BATCH_BEGIN
,
IlvBatchingDataSetListener
public void endBatch()
In the case of nested batches the listeners are notified only after the most enclosing batch is terminated.
The listeners are responsible for accumulating the events instead of
handling them immediately, if they wish to do so. The class
IlvBatchingDataSetListener
is a utility
class that helps doing so.
endBatch
in interface IlvBatchable
startBatch()
,
DataSetContentsEvent.BATCH_END
,
IlvBatchingDataSetListener
public final boolean isBatched()
startBatch()
,
endBatch()
public void fireDataSetContentsEvent(DataSetContentsEvent event)
public void fireDataSetPropertyEvent(DataSetPropertyEvent event)
public void fireDataAddedEvent(int firstIdx, int lastIdx)
firstIdx
to lastIdx
have been added to the data set.DataSetContentsEvent
public void fireDataChangedEvent(int firstIdx, int lastIdx, int eventType)
firstIdx
to lastIdx
.DataSetContentsEvent
public void addDataSetListener(DataSetListener lst)
addDataSetListener
in interface IlvDataSet
public void removeDataSetListener(DataSetListener lst)
removeDataSetListener
in interface IlvDataSet
protected void dataChanged(int firstIdx, int lastIdx, int eventType)
fireDataChangedEvent
.firstIdx
- The index of the first point impacted by the
modification.lastIdx
- The index of the last point impacted by the
modification.eventType
- The type of the notification event.protected void dataAdded(int idx)
fireDataAddedEvent
.public IlvDataPoints getData()
For optimal performance, you should dispose()
the resulting
object when done with it.
getData
in interface IlvDataSet
IlvDataPoints
representing all points.
May return null
if there are no such points.public IlvDataPoints getDataBetween(int iMin, int iMax)
For optimal performance, you should dispose()
the resulting
object when done with it.
getDataBetween
in interface IlvDataSet
iMin
- a data point index, >= 0, < getDataCount()
iMax
- a data point index, >= iMin, < getDataCount()
IlvDataPoints
representing the requested points.
May return null
if there are no such points.
Returns null
if iMin > iMax.public IlvDataPoints getDataInside(IlvDataWindow window, int adjCount, boolean continuous)
For optimal performance, you should dispose()
the resulting
object when done with it.
getDataInside
in interface IlvDataSet
window
- The considered data window.adjCount
- The number of data points immediately outside the
data window that must be returned by the request. If this parameter
is equal to 0
, only the points within the data window are
returned. A value that is not equal to 0
is only relevant
when requesting a continuous set of points (see the meaning of the
continuous
parameter).continuous
- Indicates whether the indices of the returned point
set may have holes or not. If false
, only data points
inside the given data window are returned, and possibly
adjCount data points on each side, even if the resulting
set of indices has holes, like for example
[1 2 4 7]
. If true
, a set of data points
with continuous indices is returned, even if some of them lie outside
the given data window, for example [1 2 3 4 5 6 7]
.IlvDataPoints
representing the requested points.
May return null
if there are no such points.protected IlvDataPoints getDataInside(IlvDataWindow window, int iMin, int iMax, int adjCount, boolean continuous)
For optimal performance, you should dispose()
the resulting
object when done with it.
window
- The considered data window.iMin
- Minimum data index to consider.iMax
- Maximum data index to consider.adjCount
- The number of data points immediately outside the
data window that must be returned by the request. If this parameter
is equal to 0
, only the points within the data window are
returned. A value that is not equal to 0
is only relevant
when requesting a continuous set of points (see the meaning of the
continuous
parameter).continuous
- Indicates whether the indices of the returned point
set may have holes or not. If false
, only data points
inside the given data window are returned, and possibly
adjCount data points on each side, even if the resulting
set of indices has holes, like for example
[1 2 4 7]
. If true
, a set of data points
with continuous indices is returned, even if some of them lie outside
the given data window, for example [1 2 3 4 5 6 7]
.IlvDataPoints
representing the requested points.
May return null
if there are no such points.public void putProperty(Object key, Object value, boolean notify)
putProperty
in interface IlvDataSet
key
- The key of this property.value
- The value of the property. Passing null
removes the property.notify
- If true
, changes to properties are reported
with DataSetPropertyEvent
events.
In that case, the name of the property in the event is key.toString().IlvDataSet.getProperty(java.lang.Object)
,
IlvDataSetProperty
public Object getProperty(Object key)
null
if the property has not been set on this data set.getProperty
in interface IlvDataSet
key
- The key of the property to retrieve.IlvDataSet.putProperty(java.lang.Object, java.lang.Object, boolean)
,
IlvDataSetProperty
public String toString()
public String getName()
getName
in interface IlvDataSet
public void setName(String name)
putProperty(java.lang.Object, java.lang.Object, boolean)
method.public String getDataLabel(int idx)
getDataLabel
in interface IlvDataSet
idx
- a data point index, >= 0, < getDataCount()
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.