Class Trace2DSorted
- All Implemented Interfaces:
ITrace2D
,PropertyChangeListener
,Serializable
,Comparable<ITrace2D>
,EventListener
- Direct Known Subclasses:
Trace2DLtdSorted
Trace2DReplacing
and additional features.
- All traceoints added whose x- values are not already contained are added to the internal Tree ordered by growing x-values. Therefore it is guaranteed that the tracepoints will be sorted in ascending order of x- values at any time.
Because sorted insertion of a List causes n! index- operations (
get(int i)
) additional to the comparisons this class does not
extend Trace2DSimple
which uses a List. Instead a
TreeSet
is used.
- Version:
- $Revision: 1.15 $
- Author:
- Achim Westermann
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface info.monitorenter.gui.chart.ITrace2D
ITrace2D.DistancePoint
-
Field Summary
FieldsFields inherited from class info.monitorenter.gui.chart.traces.ATrace2D
m_computingTraces, m_maxX, m_maxXErrorBar, m_maxY, m_maxYErrorBar, m_minX, m_minXErrorBar, m_minY, m_minYErrorBar, m_name, m_physicalUnitsX, m_physicalUnitsY, m_propertyChangeSupport, m_renderer
Fields inherited from interface info.monitorenter.gui.chart.ITrace2D
PROPERTY_COLOR, PROPERTY_ERRORBARPOLICY, PROPERTY_ERRORBARPOLICY_CONFIGURATION, PROPERTY_LABEL, PROPERTY_MAX_X, PROPERTY_MAX_Y, PROPERTY_MIN_X, PROPERTY_MIN_Y, PROPERTY_NAME, PROPERTY_PAINTERS, PROPERTY_PHYSICALUNITS, PROPERTY_POINT_CHANGED, PROPERTY_POINT_HIGHLIGHTERS_CHANGED, PROPERTY_STROKE, PROPERTY_TRACEPOINT, PROPERTY_VISIBLE, PROPERTY_ZINDEX, Z_INDEX_MIN, ZINDEX_MAX
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
In case p has an x- value already contained, the old tracepoint with that value will be replaced by the new one.int
Returns the maximum amount ofTracePoint2D
instances that may be added.int
getSize()
Returns the amount ofTracePoint2D
instances currently contained.boolean
isEmpty()
Returns false if internal
instances are contained or true if not.TracePoint2D
iterator()
Returns anIterator
over the internalTracePoint2D
protected void
Override this template method for the custom remove operation that depends on theCollection
used in the implementation.protected ITracePoint2D
removePointInternal
(ITracePoint2D point) Override this template method for the custom remove operation that depends on the internal storage the implementation.Methods inherited from class info.monitorenter.gui.chart.traces.ATrace2D
addComputingTrace, addErrorBarPolicy, addPoint, addPoint, addPointHighlighter, addPropertyChangeListener, addTracePainter, compareTo, containsTracePainter, ensureInitialized, finalize, firePointAdded, firePointChanged, firePointRemoved, firePropertyChange, getChangeListeners, getColor, getErrorBarPolicies, getHasErrorBars, getInstanceCount, getLabel, getMaxX, getMaxY, getMinX, getMinY, getName, getNearestPointEuclid, getNearestPointManhattan, getPhysicalUnits, getPhysicalUnitsX, getPhysicalUnitsY, getPointHighlighters, getPropertyChangeListeners, getRenderer, getStroke, getTracePainters, getZIndex, isVisible, maxXSearch, maxYSearch, minXSearch, minYSearch, propertyChange, removeAllPointHighlighters, removeAllPoints, removeComputingTrace, removeErrorBarPolicy, removePoint, removePointHighlighter, removePropertyChangeListener, removePropertyChangeListener, removeTracePainter, setColor, setErrorBarPolicy, setName, setPhysicalUnits, setPointHighlighter, setRenderer, setStroke, setTracePainter, setVisible, setZIndex, showsErrorBars, showsNegativeXErrorBars, showsNegativeYErrorBars, showsPositiveXErrorBars, showsPositiveYErrorBars, toString
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface info.monitorenter.gui.chart.ITrace2D
addComputingTrace, addErrorBarPolicy, addPoint, addPoint, addPointHighlighter, addPropertyChangeListener, addTracePainter, containsTracePainter, firePointChanged, getColor, getErrorBarPolicies, getHasErrorBars, getLabel, getMaxX, getMaxY, getMinX, getMinY, getName, getNearestPointEuclid, getNearestPointManhattan, getPhysicalUnits, getPhysicalUnitsX, getPhysicalUnitsY, getPointHighlighters, getPropertyChangeListeners, getRenderer, getStroke, getTracePainters, getZIndex, isVisible, removeAllPointHighlighters, removeAllPoints, removeComputingTrace, removeErrorBarPolicy, removePoint, removePointHighlighter, removePropertyChangeListener, removePropertyChangeListener, removeTracePainter, setColor, setErrorBarPolicy, setName, setPhysicalUnits, setPointHighlighter, setRenderer, setStroke, setTracePainter, setVisible, setZIndex, showsErrorBars, showsNegativeXErrorBars, showsNegativeYErrorBars, showsPositiveXErrorBars, showsPositiveYErrorBars
Methods inherited from interface java.beans.PropertyChangeListener
propertyChange
-
Field Details
-
m_points
The sorted set of points.
-
-
Constructor Details
-
Trace2DSorted
public Trace2DSorted()Defcon.
-
-
Method Details
-
addPointInternal
In case p has an x- value already contained, the old tracepoint with that value will be replaced by the new one. Else the new tracepoint will be added at an index in order to keep the ascending order of tracepoints with a higher x- value are contained.- Specified by:
addPointInternal
in classATrace2D
- Parameters:
p
- the point to add.- Returns:
- true if the given point was successfully added.
-
getMaxSize
public int getMaxSize()Description copied from interface:ITrace2D
Returns the maximum amount of
TracePoint2D
instances that may be added. For implementations that limit the maximum amount this is a reasonable amount. Non-limiting implementations should returnInteger.MAX_VALUE
. This allows to detect the unlimitedness. Of course no implementation could store that amount of points.- Specified by:
getMaxSize
in interfaceITrace2D
- Returns:
- The maximum amount of
TracePoint2D
instances that may be added. - See Also:
-
getSize
public int getSize()Description copied from interface:ITrace2D
Returns the amount ofTracePoint2D
instances currently contained.- Specified by:
getSize
in interfaceITrace2D
- Returns:
- The amount of
instances currently contained.TracePoint2D
- See Also:
-
isEmpty
public boolean isEmpty()Description copied from interface:ITrace2D
Returns false if internal
instances are contained or true if not.TracePoint2D
- Specified by:
isEmpty
in interfaceITrace2D
- Returns:
- false if internal
instances are contained or true if not.TracePoint2D
- See Also:
-
iterator
Description copied from interface:ITrace2D
Returns anIterator
over the internalTracePoint2D
Implementations should be synchronized. This method is meant to allow modifications of the intenal
TracePoint2D
instances, so the original points should be returned.There is no guarantee that changes made to the contained tracepoints will be reflected in the display immediately. The order the iterator returns the
TracePoint2D
instances decides how theChart2D
will paint the trace.- Specified by:
iterator
in interfaceITrace2D
- Returns:
- an
Iterator
over the internalTracePoint2D
- See Also:
-
removeAllPointsInternal
protected void removeAllPointsInternal()Description copied from class:ATrace2D
Override this template method for the custom remove operation that depends on theCollection
used in the implementation.No change events have to be fired, this is done by
ATrace2D
.- Specified by:
removeAllPointsInternal
in classATrace2D
- See Also:
-
removePointInternal
Description copied from class:ATrace2D
Override this template method for the custom remove operation that depends on the internal storage the implementation.The returned point may be the same as the given. But some "computing" traces like
will internally delete a different point and return that one.Trace2DArithmeticMean
No property change events have to be fired by default. If this method returns
null
the outer logic of the calling method
will perform bound checks for the returned point and fire property changes for the propertiesATrace2D.removePoint(ITracePoint2D)
,ITrace2D.PROPERTY_MAX_X
,ITrace2D.PROPERTY_MIN_X
andITrace2D.PROPERTY_MAX_Y
.ITrace2D.PROPERTY_MIN_Y
In special cases - when additional modifications to the internal set of points take place (e.g. a further point get added) this method should return false (regardless whether the old point was really removed or not) and perform bound checks and fire the property changes as mentioned above "manually".
- Specified by:
removePointInternal
in classATrace2D
- Parameters:
point
- the point to remove.- Returns:
- null if unsuccessful (and no events should be fired) or the point that actually was removed (in case different than the given one it should be somehow related to the given one).
- See Also:
-