Package scene.camera

Class CameraIterator

java.lang.Object
util.EfficientIterator<Pixel<Ray[]>>
scene.camera.CameraIterator
All Implemented Interfaces:
java.util.Iterator<Pixel<Ray[]>>

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 fields next and hasNext.

    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

      public CameraIterator​(Camera camera)
      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 fields next and hasNext. Each subsequent call to this method should set next to the subsequent element of the iterable. If there are more elements, then next should be set to the next element that is to be returned by EfficientIterator.next(). Otherwise, hasNext should be set to false (the value of naxt is irrelevant in this case). This method may be used by the derived constructors to set the values of next initially in preperation for the first iteration.
      Specified by:
      setNext in class EfficientIterator<Pixel<Ray[]>>