|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.freecol.common.model.Player.UnitIterator
public class Player.UnitIterator
An Iterator of Units that can be made active.
| Field Summary | |
|---|---|
private Player |
owner
|
private Player.UnitPredicate |
predicate
|
private java.util.List<Unit> |
units
|
private java.util.Comparator<Unit> |
xyComparator
A comparator to compare units by position, top to bottom, left to right. |
| Constructor Summary | |
|---|---|
Player.UnitIterator(Player owner,
Player.UnitPredicate predicate)
Creates a new UnitIterator. |
|
| Method Summary | |
|---|---|
boolean |
hasNext()
Check if there is any more valid units. |
Unit |
next()
Get the next valid unit. |
void |
remove()
Removes from the underlying collection the last element returned by the iterator (optional operation). |
void |
reset()
Reset the internal units list, initially only with units that satisfy the predicate. |
boolean |
setNext(Unit unit)
Set the next valid unit. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private Player owner
private Player.UnitPredicate predicate
private java.util.List<Unit> units
private final java.util.Comparator<Unit> xyComparator
| Constructor Detail |
|---|
public Player.UnitIterator(Player owner,
Player.UnitPredicate predicate)
UnitIterator.
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 |
|---|
public void reset()
public boolean hasNext()
hasNext in interface java.util.Iterator<Unit>public Unit next()
next in interface java.util.Iterator<Unit>public boolean setNext(Unit unit)
unit - The Unit to put at the front of the list.
public void remove()
remove in interface java.util.Iterator<Unit>java.lang.UnsupportedOperationException - no matter what.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||