Documentation of 'info.monitorenter.gui.chart.traces.Trace2DLtd' Java class
Trace2DLtd
info.monitorenter.gui.chart.traces

Class Trace2DLtd

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


    public class Trace2DLtd
    extends ATrace2D
    implements ITrace2D
    Additional to the Trace2DSimple the Trace2DLimited adds the following functionality:

    • The amount of internal tracepoints is limited to the maxsize, passed to the constructor.
    • If a new tracepoint is inserted and the maxsize has been reached, the tracepoint residing for the longest time in this trace is thrown away.
    Take this implementation to display frequently changing data (nonstatic, time - dependant values). You will avoid a huge growing amount of tracepoints that would increase the time for scaling and painting until system hangs or java.lang.OutOfMemoryError is thrown.

    See Also:
    Serialized Form
    • Constructor Detail

      • Trace2DLtd

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

      • Trace2DLtd

        public Trace2DLtd(int maxsize)
        Constructs an instance with a buffersize of maxsize and a default name.

        Parameters:
        maxsize - the buffer size for the maximum amount of points that will be shown.
      • Trace2DLtd

        public Trace2DLtd(int maxsize,
                          java.lang.String name)
        Constructs an instance with a buffersize of maxsize and a default name.

        Parameters:
        maxsize - the buffer size for the maximum amount of points that will be shown.
        name - the name that will be displayed for this trace.
      • Trace2DLtd

        public Trace2DLtd(java.lang.String name)
        Creates an instance with a default buffersize of 100 and the given name.

        Parameters:
        name - the name that will be displayed for the trace.
    • Method Detail

      • equals

        public boolean equals(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
        See Also:
        Object.equals(java.lang.Object)
      • 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 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()
      • getSize

        public int getSize()
        Returns the acutal amount of points in this trace.

        Specified by:
        getSize in interface ITrace2D
        Returns:
        the acutal amount of points in this trace.
        See Also:
        ITrace2D.getSize()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
        See Also:
        Object.hashCode()
      • 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()
      • removeAllPointsInternal

        public void removeAllPointsInternal()
        Description copied from class: ATrace2D
        Override this template method for the custom remove operation that depends on the Collection used in the implementation.

        No change events have to be fired, this is done by ATrace2D.

        See Also:
        ITrace2D.removeAllPoints()
      • setMaxSize

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

        Don't use this too often as decreases in size may cause expensive array copy operations and new searches on all points for bound changes.

        TODO: Only search for bounds if size is smaller than before, debug and test.

        Parameters:
        amount - the new maximum amount of points to show.

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.