Class XYPlot.Curve.Itr

  • Enclosing class:
    XYPlot.Curve

    public class XYPlot.Curve.Itr
    extends java.lang.Object
    Iterator for the curve. 2D, does not follow Java collections style. The reason is that we want to have #getX() and #getY() operations, which does not work consistently with Java's next() style of iterations. Instead, use this style of iteration:
     
     for (XYCurve.Itr it = curve.iterator(); it.valid(); it.advance()) {
       doSomethingWith(it.getX(), it.getY());
     }
     
     
    Author:
    Erich Schubert
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int pos
      Iterator position
    • Constructor Summary

      Constructors 
      Constructor Description
      Itr()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void advance()
      Advance the iterator to the next position.
      double getX()
      Get x value of current element.
      double getY()
      Get y value of current element.
      boolean valid()
      Test if the iterator can advance.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • pos

        protected int pos
        Iterator position
    • Constructor Detail

      • Itr

        public Itr()
    • Method Detail

      • getX

        public double getX()
        Get x value of current element.
        Returns:
        X value of current element
      • getY

        public double getY()
        Get y value of current element.
        Returns:
        Y value of current element
      • advance

        public void advance()
        Advance the iterator to the next position.
      • valid

        public boolean valid()
        Test if the iterator can advance.
        Returns:
        True when the iterator can be advanced.