net.sf.freecol.common.model
Class Player.UnitIterator
java.lang.Object
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.
|
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 |
unitIterator
private java.util.Iterator<Unit> unitIterator
owner
private Player owner
nextUnit
private Unit nextUnit
predicate
private Player.UnitPredicate predicate
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.
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.