Class Trace2DSimple

  • All Implemented Interfaces:
    ITrace2D, java.beans.PropertyChangeListener, java.io.Serializable, java.lang.Comparable<ITrace2D>, java.util.EventListener
    Direct Known Subclasses:
    Trace2DBijective, Trace2DReplacing

    public class Trace2DSimple
    extends ATrace2D
    implements ITrace2D
    A basic ITrace2D implementation that stores the internal TracePoint2D instances in a List.

    This class has the following behavior:

    • All tracepoints that are added are stored unchanged in a LinkedList.
    • All traceoints that are added are added to the end.
    • If a tracepoint is inserted whose x - value already exists in the List, it is ok - the old point may remain. (no bijective assigement of X and Y)

    Version:
    $Revision: 1.16 $
    Author:
    Achim Westermann
    See Also:
    Serialized Form
    • Field Detail

      • m_points

        protected java.util.List<ITracePoint2D> m_points
        Internal List <ITracePoint2D>.
    • Constructor Detail

      • Trace2DSimple

        public Trace2DSimple()
        Creates an empty trace.

      • Trace2DSimple

        public Trace2DSimple​(java.lang.String name)
        Creates an emtpy trace with the given name.

        Parameters:
        name - the name that will be displayed below the chart.
    • Method Detail

      • addPointInternal

        protected boolean addPointInternal​(ITracePoint2D p)
        Description copied from class: ATrace2D

        Override this template method for the custom add operation that depends on the policies of the implementation.

        No property change events have to be fired by default. If this method returns true the outer logic of the calling method ATrace2D.addPoint(ITracePoint2D) will perform bound checks for the new point and fire property changes as described in method ATrace2D.firePointChanged(ITracePoint2D, int).

        In special cases - when additional modifications to the internal set of points take place (e.g. a further point gets removed) this method should return false (regardless whether the new point was accepted or not) and perform bound checks and fire the property changes as mentioned above "manually".

        Specified by:
        addPointInternal in class ATrace2D
        Parameters:
        p - the point to add.
        Returns:
        true if the given point was accepted or false if not.
        See Also:
        ATrace2D.addPointInternal(info.monitorenter.gui.chart.ITracePoint2D)
      • 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
        Returns:
        The maximum amount of TracePoint2D instances that may be added.
        See Also:
        ITrace2D.getMaxSize()
      • iterator

        public java.util.Iterator<ITracePoint2D> iterator()
        Description copied from interface: ITrace2D
        Returns an Iterator over the internal TracePoint2D instances.

        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 the Chart2D will paint the trace.

        Specified by:
        iterator in interface ITrace2D
        Returns:
        an Iterator over the internal TracePoint2D instances.
        See Also:
        ITrace2D.iterator()
      • removePointInternal

        protected ITracePoint2D removePointInternal​(ITracePoint2D point)
        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 Trace2DArithmeticMean will internally delete a different point and return that one.

        No property change events have to be fired by default. If this method returns null the outer logic of the calling method ATrace2D.removePoint(ITracePoint2D) will perform bound checks for the returned point and fire property changes for the properties ITrace2D.PROPERTY_MAX_X, ITrace2D.PROPERTY_MIN_X, ITrace2D.PROPERTY_MAX_Y and 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 class ATrace2D
        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:
        ATrace2D.removePointInternal(info.monitorenter.gui.chart.ITracePoint2D)