Interface Cursor<T>
- All Superinterfaces:
EuclideanSpace, Iterator<T>, Iterator, Localizable, RealCursor<T>, RealLocalizable, Sampler<T>, Typed<T>
- All Known Implementing Classes:
AbstractArrayCursor, AbstractArrayLocalizingCursor, AbstractConvertedCursor, AbstractCursor, AbstractCursorInt, AbstractLocalizingCursor, AbstractLocalizingCursorInt, AbstractLongListImg.LongListCursor, AbstractLongListImg.LongListLocalizingCursor, ArrayCursor, ArrayLocalizingCursor, ArrayLocalizingSubIntervalCursor, ArraySubIntervalCursor, BiConvertedCursor, CellCursor, CellLocalizingCursor, ConvertedCursor, ListCursor, ListLocalizingCursor, NtreeCursor, PlanarCursor, PlanarCursor1D, PlanarCursor2D, PlanarLocalizingCursor, PlanarLocalizingCursor1D, PlanarLocalizingCursor2D, PlanarPlaneSubsetCursor, PlanarPlaneSubsetLocalizingCursor, PointSampleList.PointSampleListCursor, RandomAccessibleIntervalCursor, SlicingCursor, WriteConvertedCursor
Cursor is a combination of several interfaces to achieve this. The
Iterator interface is used to iterate the set. Use
Iterator.fwd() to advance the cursor and Iterator.hasNext()
to check whether there are more elements. Note, that the Cursor starts
before the first element, i.e., you have to call fwd() once
to move to the first element.
The Localizable interface provides access to the position of the
current element. The Sampler.get() method of the Sampler
interface provides access to the value of the current element.
For convenience, Cursor also extends the Iterator interface
so that you are able to use Cursors in for-each loops. Calling the
Iterator.next() method is equivalent to calling
fwd() and get(). That is, after next() the Cursor is
on the element returned by next(). get() can be used to
obtain that element (again), and getPosition() to obtain its
position. The Iterator.remove() method is not supported by
imglib Cursors, in general.
It is not guaranteed that a Cursor will perform bounds checking. Asking the position or value of a Cursor that was not advanced to its first element, or was moved beyond its last element, has undefined results.
-
Method Summary
Methods inherited from interface EuclideanSpace
numDimensionsMethods inherited from interface Iterator
forEachRemaining, hasNext, removeMethods inherited from interface Localizable
getDoublePosition, getFloatPosition, getIntPosition, getLongPosition, localize, localize, localize, localize, positionAsLongArray, positionAsPointMethods inherited from interface RealCursor
nextMethods inherited from interface RealLocalizable
localize, localize, positionAsDoubleArray, positionAsRealPoint
-
Method Details
-
copyCursor
Deprecated.Usecopy()instead- Specified by:
copyCursorin interfaceRealCursor<T>
-
copy
- Specified by:
copyin interfaceRealCursor<T>- Specified by:
copyin interfaceSampler<T>- Returns:
- - A new
Samplerin the same state accessing the same values. It does NOT copy T, just the state of theSampler. Otherwise use T.copy() if available. Sampler.copy().get() == Sampler.get(), i.e. both hold the same value, not necessarily the same instance (this is the case for anArrayCursorfor example)
-
copy()instead