info.monitorenter.gui.chart.traces
Class Trace2DLtdSorted

java.lang.Object
  extended by info.monitorenter.gui.chart.traces.ATrace2D
      extended by info.monitorenter.gui.chart.traces.Trace2DSorted
          extended by info.monitorenter.gui.chart.traces.Trace2DLtdSorted
All Implemented Interfaces:
ITrace2D, java.beans.PropertyChangeListener, java.io.Serializable, java.lang.Comparable<ITrace2D>, java.util.EventListener

public class Trace2DLtdSorted
extends Trace2DSorted

Additional to the Trace2DLtdReplacing all tracepoints will be sorted by their x- value.

Performance is slower compared to the class named above. Internally a TreeSet is used (instead of RingBufferArrayFast) to keep the comparable TracePoint2D- instances sorted. Internally all tracepoints are TracePoint2D -instances.

Version:
$Revision: 1.12 $
Author:
Achim Westermann
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface info.monitorenter.gui.chart.ITrace2D
ITrace2D.DistancePoint
 
Field Summary
protected  int m_maxsize
          The maximum amount of points that will be shown.
 
Fields inherited from class info.monitorenter.gui.chart.traces.Trace2DSorted
m_points
 
Fields 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
Trace2DLtdSorted()
          Constructs an instance with a default buffer size of 100.
Trace2DLtdSorted(int maxsize)
          Constructs an instance with a buffer size of maxsize.
 
Method Summary
protected  boolean addPointInternal(ITracePoint2D point)
          In case point has an x- value already contained, the old trace point with that value will be replaced by the new one.
 int getMaxSize()
           Returns the maximum amount of TracePoint2D instances that may be added.
 void setMaxSize(int amount)
          Sets the maximum amount of points that will be shown.
 
Methods inherited from class info.monitorenter.gui.chart.traces.Trace2DSorted
getSize, isEmpty, iterator, removeAllPointsInternal, removePointInternal
 
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 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
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

m_maxsize

protected int m_maxsize
The maximum amount of points that will be shown.

Constructor Detail

Trace2DLtdSorted

public Trace2DLtdSorted()
Constructs an instance with a default buffer size of 100.


Trace2DLtdSorted

public Trace2DLtdSorted(int maxsize)
Constructs an instance with a buffer size of maxsize.

Parameters:
maxsize - the maximum amount of points to show.
Method Detail

addPointInternal

protected boolean addPointInternal(ITracePoint2D point)
In case point has an x- value already contained, the old trace point with that value will be replaced by the new one. Else the new trace point will be added at an index in order to keep the ascending order of trace points with a higher x- value are contained.

If points takes additional space (it's x- value is not already contained) and maxsize is reached, the first element (with lowest x- value) will be removed.

Overrides:
addPointInternal in class Trace2DSorted
Parameters:
point - the point to add.
Returns:
true if the point was successfully removed.

getMaxSize

public final 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 return Integer.MAX_VALUE. This allows to detect the unlimitedness. Of course no implementation could store that amount of points.

Specified by:
getMaxSize in interface ITrace2D
Overrides:
getMaxSize in class Trace2DSorted
Returns:
The maximum amount of TracePoint2D instances that may be added.
See Also:
ITrace2D.getMaxSize()

setMaxSize

public final void setMaxSize(int amount)
Sets the maximum amount of points that will be shown.

Parameters:
amount - the maximum amount of points that will be shown.


Copyright © 2001 - 2010 LGPL, All Rights Footloose.