net.sf.freecol.common.model
Class Player.UnitIterator

java.lang.Object
  extended by net.sf.freecol.common.model.Player.UnitIterator
All Implemented Interfaces:
java.util.Iterator<Unit>
Enclosing class:
Player

public class Player.UnitIterator
extends java.lang.Object
implements java.util.Iterator<Unit>

An Iterator of Units that can be made active.


Field Summary
private  Unit nextUnit
           
private  Player owner
           
private  Player.UnitPredicate predicate
           
private  java.util.Iterator<Unit> unitIterator
           
 
Constructor Summary
Player.UnitIterator(Player owner, Player.UnitPredicate predicate)
          Creates a new NextActiveUnitIterator.
 
Method Summary
private  java.util.Iterator<Unit> createUnitIterator()
          Returns an Iterator for the units of this player that can be active.
 boolean hasNext()
           
 Unit next()
           
 void remove()
          Removes from the underlying collection the last element returned by the iterator (optional operation).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

unitIterator

private java.util.Iterator<Unit> unitIterator

owner

private Player owner

nextUnit

private Unit nextUnit

predicate

private Player.UnitPredicate predicate
Constructor Detail

Player.UnitIterator

public Player.UnitIterator(Player owner,
                           Player.UnitPredicate predicate)
Creates a new NextActiveUnitIterator.

Parameters:
owner - The Player that needs an iterator of it's units.
predicate - An object for deciding whether a Unit should be included in the Iterator or not.
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator<Unit>

next

public Unit next()
Specified by:
next in interface java.util.Iterator<Unit>

remove

public void remove()
Removes from the underlying collection the last element returned by the iterator (optional operation).

Specified by:
remove in interface java.util.Iterator<Unit>
Throws:
java.lang.UnsupportedOperationException - no matter what.

createUnitIterator

private java.util.Iterator<Unit> createUnitIterator()
Returns an Iterator for the units of this player that can be active.