Package noaa.coastwatch.util
Class LineLocationIterator
java.lang.Object
noaa.coastwatch.util.LineLocationIterator
- All Implemented Interfaces:
Iterator<DataLocation>
,DataLocationIterator
,ResettableIterator
The
LineLocationIterator
class iterates over data
locations along a line between start and end locations. See LineIterator
for details on how the locations
are incremented along a line. Currently, only 2D data locations
are supported.- Since:
- 3.1.7
- Author:
- Peter Hollemans
-
Constructor Summary
ConstructorDescriptionLineLocationIterator
(DataLocation start, DataLocation end) Creates a new line location iterator. -
Method Summary
Modifier and TypeMethodDescriptionboolean
hasNext()
static void
Tests this class.next()
nextLocation
(DataLocation loc) Gets the next data location.void
remove()
void
reset()
Resets the iterator to the first element.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
LineLocationIterator
Creates a new line location iterator. The starting and ending locations are rounded to the nearest integer coordinates prior to deriving the line data locations.- Parameters:
start
- the starting data location.end
- the ending data location.
-
-
Method Details
-
hasNext
public boolean hasNext()- Specified by:
hasNext
in interfaceIterator<DataLocation>
-
nextLocation
Description copied from interface:DataLocationIterator
Gets the next data location.- Specified by:
nextLocation
in 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:
remove
in interfaceIterator<DataLocation>
-
reset
public void reset()Description copied from interface:ResettableIterator
Resets the iterator to the first element.- Specified by:
reset
in interfaceResettableIterator
-
next
- Specified by:
next
in interfaceIterator<DataLocation>
-
main
Tests this class.- Parameters:
argv
- the array of command line parameters.
-