public class Caretaker
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
Caretaker.ChangeListener
Callback interface for listening to changes to the numbers.
|
Modifier and Type | Field and Description |
---|---|
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 |
Modifier and Type | Method and Description |
---|---|
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 |
triggerOneCountUpdate(CreatureType type) |
private void |
triggerOneDeadCount(CreatureType type,
int count) |
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
public Caretaker(Game game)
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 triggerOneCountUpdate(CreatureType type)
private void triggerFullUpdate()
public void takeOne(CreatureType type)
public void putOneBack(CreatureType type)
public void putDeadOne(CreatureType type)
public void resurrectImmortals()