Scribble Problem Set Javadocs

cs101.awt.geom
Class PointIterator

java.lang.Object
  extended bycs101.awt.geom.PointIterator

public class PointIterator
extends java.lang.Object

This class provides a simple interface for listing all the knot points in an java.awt.Shape.

Version:
$Id: PointIterator.java,v 1.7 2003/03/06 21:58:16 gus Exp $
Author:
Patrick G. Heck gus.heck@olin.edu

Constructor Summary
PointIterator(java.awt.Shape s)
          Creates a PointIterator for the specified Shape.
 
Method Summary
 boolean hasNext()
          Test to see if the entire shape has been processed.
 boolean isStart(java.awt.geom.Point2D.Float pt)
          Test to see if the supplied point is the same object as the current start point for the current path.
 java.awt.geom.Point2D.Float nextPoint()
          Return the next point in the shape.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PointIterator

public PointIterator(java.awt.Shape s)
Creates a PointIterator for the specified Shape.

Parameters:
s - the Shape to iterate over.
Method Detail

hasNext

public boolean hasNext()
Test to see if the entire shape has been processed.

Returns:
true if all points in the shape have been returned. false otherwise.

isStart

public boolean isStart(java.awt.geom.Point2D.Float pt)
Test to see if the supplied point is the same object as the current start point for the current path. If this test fails after it has succeeded then the itterator can be assumed to have begun a new portion of a discontinuous GeneralPath, or similar shape.

Parameters:
pt - The point to test

nextPoint

public java.awt.geom.Point2D.Float nextPoint()
Return the next point in the shape. When a path in the shape is closed, The object returned is the same object that was returned for the last moveTo such that (return value of moveTo) == (return value of close). Note that this is only useful for simple shapes that contain only one path. There is no means provided in PathIterator to distinguish points returned from a moveTo segments beyond the first segment (which is guaranteed by Sun to be a moveTo).

Returns:
The next point in the shape.

Scribble Problem Set Javadocs