uavsim.datatypes
Class Interval.Iterator

java.lang.Object
  extended by uavsim.datatypes.Interval.Iterator
Enclosing class:
Interval<_UNIT_ extends I_Unitable<_UNIT_>>

public class Interval.Iterator
extends java.lang.Object

Defines an iterator over the interval.

Author:
Dan Tappan [24.06.11]

Field Summary
private  boolean _isInclusive2
          whether to include the end value
private  _UNIT_ _step2
          the amount to move for each step
private  int _stepCount
          the number of steps between the start and end values
private  int _stepIndex
          the step index between the start and end angles to visit
private  _UNIT_ _value
          the current value
 
Constructor Summary
Interval.Iterator(_UNIT_ step, boolean isInclusive)
          Creates an interval iterator.
 
Method Summary
 boolean hasNext()
          Whether there is another value to step to in the forward direction.
 boolean hasPrevious()
          Whether there is another value to step to in the backward direction.
 boolean isInclusive()
          Returns whether to include the end value.
 boolean isReversed()
          Returns whether to iterate in from end to start.
 void resetToEnd()
          Sets the iterator to the end value.
 void resetToStart()
          Sets the iterator to the start value.
 _UNIT_ stepToNext()
          Moves to the next value in the forward direction and returns it.
 _UNIT_ stepToPrevious()
          Moves to the next value in the backward direction and returns it.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_isInclusive2

private final boolean _isInclusive2
whether to include the end value


_step2

private final _UNIT_ extends I_Unitable<_UNIT_> _step2
the amount to move for each step


_stepCount

private final int _stepCount
the number of steps between the start and end values


_stepIndex

private int _stepIndex
the step index between the start and end angles to visit


_value

private _UNIT_ extends I_Unitable<_UNIT_> _value
the current value

Constructor Detail

Interval.Iterator

public Interval.Iterator(_UNIT_ step,
                         boolean isInclusive)
Creates an interval iterator.

Parameters:
step - - the angle to move for each step
isInclusive - - whether to include the end value
Method Detail

hasNext

public boolean hasNext()
Whether there is another value to step to in the forward direction. The concept of "next" depends on the step direction.

Returns:
the result

hasPrevious

public boolean hasPrevious()
Whether there is another value to step to in the backward direction. The concept of "previous" depends on the step direction.

Returns:
the result

isInclusive

public boolean isInclusive()
Returns whether to include the end value.

Returns:
the state

isReversed

public boolean isReversed()
Returns whether to iterate in from end to start.

Returns:
the state

resetToEnd

public void resetToEnd()
Sets the iterator to the end value.


resetToStart

public void resetToStart()
Sets the iterator to the start value.


stepToNext

public _UNIT_ stepToNext()
Moves to the next value in the forward direction and returns it. The concept of "next" depends on the step direction.

Returns:
the value

stepToPrevious

public _UNIT_ stepToPrevious()
Moves to the next value in the backward direction and returns it. The concept of "previous" depends on the step direction.

Returns:
the value

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object