Class Trace2DBijective

All Implemented Interfaces:
ITrace2D, PropertyChangeListener, Serializable, Comparable<ITrace2D>, EventListener

public class Trace2DBijective extends Trace2DSimple
A Trace2D who only allows a single occurance of a tracepoint with a certain x- value xi.

From y1 = f(x1) = f(x2) follows: x1==x2 (injective)
For every y- value yi contained there exists at least one value xi (surjective)
Both qualities joined result in a bijective assignment between x and y values.

The policy for both addPoint- methods is implemented as follows:

  • Every point whose x- value is not contained yet is appended at the end of the internal list.
  • If the x- value is contained before, the tracepoint with that value is removed and the new point is added to the end of the internal list. In that case the new tracepoint is not inserted at the location where the old point used to be!

Version:
$Revision: 1.15 $
Author:
Achim Westermann Achim.Westermann@gmx.de
See Also:
  • Constructor Details

    • Trace2DBijective

      public Trace2DBijective()
      Defcon of this stateless instance.
  • Method Details

    • 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".

      Overrides:
      addPointInternal in class Trace2DSimple
      Parameters:
      p - the point to add.
      Returns:
      true if the given point was accepted or false if not.
      See Also: