Package scene.camera
Class CameraIterator
java.lang.Object
public class CameraIterator extends EfficientIterator<Pixel<Ray[]>>
An iterator to iterate over the rays shot by the camera.
This iterator is thred safe. However, it is imperative that calls to
EfficientIterator.hasNext()
and EfficientIterator.next()
which
logically depend on each other be surrounded by a synchronized
block. For example, a thread repeatedly
calling EfficientIterator.next()
need not have a synchronized
block, but if it first checks EfficientIterator.hasNext()
and then
expects EfficientIterator.next()
not to throw an exception, those two calls must be in the same synchronized
block.-
Field Summary
Fields inherited from class util.EfficientIterator
hasNext, next
-
Constructor Summary
Constructors Constructor Description CameraIterator(Camera camera)
Get an iterator to iterate over the rays shot by the camera. -
Method Summary
Modifier and Type Method Description protected void
setNext()
This method should set the values of the fieldsnext
andhasNext
.Methods inherited from class util.EfficientIterator
hasNext, next
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, remove
-
Constructor Details
-
CameraIterator
Get an iterator to iterate over the rays shot by the camera.- Parameters:
camera
- The camera whose rays to iterate over.
-
-
Method Details
-
setNext
protected void setNext()Description copied from class:EfficientIterator
This method should set the values of the fieldsnext
andhasNext
. Each subsequent call to this method should set next to the subsequent element of the iterable. If there are more elements, thennext
should be set to the next element that is to be returned byEfficientIterator.next()
. Otherwise,hasNext
should be set to false (the value ofnaxt
is irrelevant in this case). This method may be used by the derived constructors to set the values ofnext
initially in preperation for the first iteration.- Specified by:
setNext
in classEfficientIterator<Pixel<Ray[]>>
-