Package noaa.coastwatch.util
Class ConstrainedStrideLocationIterator
java.lang.Object
noaa.coastwatch.util.ConstrainedStrideLocationIterator
- All Implemented Interfaces:
Iterator<DataLocation>,DataLocationIterator,ResettableIterator
The
ConstrainedStrideLocationIterator class iterates
over data locations using a constant step stride vector, but uses a
java.awt.Shape object to determine if each location is
contained within a shape boundary. See DataLocation.increment(int[],int[]) for
details on how the locations are incremented with a stride.- Since:
- 3.1.7
- Author:
- Peter Hollemans
-
Constructor Summary
ConstructorsConstructorDescriptionConstrainedStrideLocationIterator(Shape shape, int[] stride) Creates a new constrained stride location iterator. -
Method Summary
Modifier and TypeMethodDescriptionbooleanhasNext()static voidTests this class.next()nextLocation(DataLocation loc) Gets the next data location.voidremove()voidreset()Resets the iterator to the first element.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
ConstrainedStrideLocationIterator
Creates a new constrained stride location iterator.- Parameters:
shape- the shape to use for constraining the iterator data locations.stride- the data location stride in each dimension.
-
-
Method Details
-
hasNext
public boolean hasNext()- Specified by:
hasNextin interfaceIterator<DataLocation>
-
nextLocation
Description copied from interface:DataLocationIteratorGets the next data location.- Specified by:
nextLocationin interfaceDataLocationIterator- Parameters:
loc- the location to fill in with coordinates, or null to allocate a new location.- Returns:
- the next location. The location is allocated only if the passed location is null, otherwise the same location is returned.
-
remove
public void remove()- Specified by:
removein interfaceIterator<DataLocation>
-
reset
public void reset()Description copied from interface:ResettableIteratorResets the iterator to the first element.- Specified by:
resetin interfaceResettableIterator
-
next
- Specified by:
nextin interfaceIterator<DataLocation>
-
main
Tests this class.- Parameters:
argv- the array of command line parameters.
-