Stay organized with collections Save and categorize content based on your preferences.

public class PathIterator
extends Object implements Iterator<PathIterator.Segment>



PathIterator can be used to query a given Path object, to discover its operations and point values.

Summary

Nested classes

class PathIterator.Segment

This class holds the data for a given segment in a path, as returned by PathIterator.next()

Constants

int VERB_CLOSE
int VERB_CONIC
int VERB_CUBIC
int VERB_DONE
int VERB_LINE
int VERB_MOVE
int VERB_QUAD

Public methods

boolean hasNext()

Returns true if the there are more elements in this iterator to be returned.

int next(float[] points, int offset)

Returns the next verb in this iterator's Path, and fills entries in the points array with the point data (if any) for that operation.

PathIterator.Segment next()

Returns the next Segment element in this iterator.

int peek()

Returns the next verb in the iteration, or VERB_DONE if there are no more elements.

Inherited methods

From class java.lang.Object

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

From interface java.util.Iterator

default void forEachRemaining(Consumer<? super E> action)

Performs the given action for each remaining element until all elements have been processed or the action throws an exception.

abstract boolean hasNext()

Returns true if the iteration has more elements.

abstract PathIterator.Segment next()

Returns the next element in the iteration.

default void remove()

Removes from the underlying collection the last element returned by this iterator (optional operation).

Constants

VERB_CLOSE

public static final int VERB_CLOSE

Constant Value: 5 (0x00000005)

VERB_CONIC

public static final int VERB_CONIC

Constant Value: 3 (0x00000003)

VERB_CUBIC

public static final int VERB_CUBIC

Constant Value: 4 (0x00000004)

VERB_DONE

public static final int VERB_DONE

Constant Value: 6 (0x00000006)

VERB_LINE

public static final int VERB_LINE

Constant Value: 1 (0x00000001)

VERB_MOVE

public static final int VERB_MOVE

Constant Value: 0 (0x00000000)

VERB_QUAD

public static final int VERB_QUAD

Constant Value: 2 (0x00000002)

Public methods

hasNext

public boolean hasNext ()

Returns true if the there are more elements in this iterator to be returned. A return value of false means there are no more elements, and an ensuing call to next() or next(float[], int) )} will return VERB_DONE.

Returns
boolean true if there are more elements to be iterated through, false otherwise
Throws
ConcurrentModificationException if the underlying path was modified since this iterator was created.

next

public int next (float[] points, 
                int offset)

Returns the next verb in this iterator's Path, and fills entries in the points array with the point data (if any) for that operation. Each two floats represent the data for a single point of that operation. The number of pairs of floats supplied in the resulting array depends on the verb:

Parameters
points float: The point data for this operation, must have at least 8 items available to hold up to 4 pairs of point values This value cannot be null.
offset int: An offset into the points array where entries should be placed.
Returns
int the operation for the next element in the iteration This value cannot be null. Value is VERB_MOVE, VERB_LINE, VERB_QUAD, VERB_CONIC, VERB_CUBIC, VERB_CLOSE, or VERB_DONE
Throws
ArrayIndexOutOfBoundsException if the points array is too small
ConcurrentModificationException if the underlying path was modified since this iterator was created.

next

public PathIterator.Segment next ()

Returns the next Segment element in this iterator. There are two versions of next(). This version is slightly more expensive at runtime, since it allocates a new Segment object with every call. The other version, next(float[], int) requires no such allocation, but requires a little more manual effort to use.

Returns
PathIterator.Segment the next segment in this iterator This value cannot be null.
Throws
ConcurrentModificationException if the underlying path was modified since this iterator was created.

peek

public int peek ()

Returns the next verb in the iteration, or VERB_DONE if there are no more elements.

Returns
int the next verb in the iteration, or VERB_DONE if there are no more elements This value cannot be null. Value is VERB_MOVE, VERB_LINE, VERB_QUAD, VERB_CONIC, VERB_CUBIC, VERB_CLOSE, or VERB_DONE
Throws
ConcurrentModificationException if the underlying path was modified since this iterator was created.

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2023-02-08 UTC.