|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.colossus.game.Caretaker
public class Caretaker
The caretaker tracks the number of creatures still available and those dead. For each creature type the number of creatures still available for mustering and the number of creatures already dead is stored. The latter function means this version of a caretaker integrates what is called a 'graveyard' in a normal Titan game.
Nested Class Summary | |
---|---|
static interface |
Caretaker.ChangeListener
Callback interface for listening to changes to the numbers. |
Field Summary | |
---|---|
private java.util.Map<CreatureType,java.lang.Integer> |
creatureAvailableCounts
Map of creature types to the number of available creatures. |
private java.util.Map<CreatureType,java.lang.Integer> |
creatureDeadCounts
Map of creature types to the number of dead creatures. |
private Game |
game
The game of which we manage the creatures. |
private java.util.List<Caretaker.ChangeListener> |
listeners
All parties interested in changes to our numbers. |
private static java.util.logging.Logger |
LOGGER
|
Constructor Summary | |
---|---|
Caretaker(Game game)
|
Method Summary | |
---|---|
void |
addListener(Caretaker.ChangeListener listener)
|
void |
adjustAvailableCount(CreatureType type)
|
int |
getAvailableCount(CreatureType type)
|
int |
getDeadCount(CreatureType type)
|
protected Game |
getGame()
|
void |
putDeadOne(CreatureType type)
|
void |
putOneBack(CreatureType type)
|
void |
removeListener(Caretaker.ChangeListener listener)
|
void |
resetAllCounts()
|
void |
resurrectImmortals()
Move dead non-Titan immortals back to stacks. |
void |
setAvailableCount(CreatureType type,
int availableCount)
|
void |
setDeadCount(CreatureType type,
int deadCount)
|
void |
takeOne(CreatureType type)
|
private void |
triggerFullUpdate()
|
private void |
triggerOneAvailabilityCount(CreatureType type,
int count)
|
private void |
triggerOneDeadCount(CreatureType type,
int count)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.util.logging.Logger LOGGER
private final java.util.Map<CreatureType,java.lang.Integer> creatureAvailableCounts
private final java.util.Map<CreatureType,java.lang.Integer> creatureDeadCounts
private final Game game
private final java.util.List<Caretaker.ChangeListener> listeners
Constructor Detail |
---|
public Caretaker(Game game)
Method Detail |
---|
public void resetAllCounts()
public void setAvailableCount(CreatureType type, int availableCount)
public void setDeadCount(CreatureType type, int deadCount)
public int getAvailableCount(CreatureType type)
public void adjustAvailableCount(CreatureType type)
public int getDeadCount(CreatureType type)
protected Game getGame()
public void addListener(Caretaker.ChangeListener listener)
public void removeListener(Caretaker.ChangeListener listener)
private void triggerOneAvailabilityCount(CreatureType type, int count)
private void triggerOneDeadCount(CreatureType type, int count)
private void triggerFullUpdate()
public void takeOne(CreatureType type)
public void putOneBack(CreatureType type)
public void putDeadOne(CreatureType type)
public void resurrectImmortals()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |