public class World
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> |
animals |
private int |
autorun |
private int |
averageGrassDensity |
private int |
carnivoreCounter |
private int |
herbivoreCounter |
private int |
highestGeneration |
private Humidity |
humidity |
private java.util.ArrayList<java.lang.String> |
news |
private int |
nextID |
private boolean |
running |
private int[] |
size |
private int |
startEnergyCarnivores |
private int |
startEnergyHerbivores |
private int |
startGrassDensity |
private int |
startNoCarnivores |
private int |
startNoHerbivores |
private int |
stopAt |
private int |
timelapse |
private int |
turn |
private int |
waterTiles |
private static World |
world |
Modifier | Constructor and Description |
---|---|
private |
World()
This class implements Singleton, therefore the constructor is private.
|
Modifier and Type | Method and Description |
---|---|
java.util.ArrayList<java.lang.String> |
collectNews() |
java.util.HashMap<java.lang.String,java.lang.Integer> |
getAnimalInfo(int x,
int y)
Return information about the animal at the given position as a hash map
|
int |
getAutorun() |
int |
getAverageGrassDensity() |
int |
getCarnivoreCount() |
java.util.HashMap<java.lang.String,java.lang.Integer> |
getDefaultGenome(OccupantType type)
Return a hash map holding all the genome values
|
java.util.HashMap<java.lang.String,java.lang.Integer> |
getFieldInfo(int x,
int y)
Return information about the map field at the given position as a hash map
|
int |
getGeneration() |
int |
getHerbivoreCount() |
Humidity |
getHumidity() |
static World |
getInstance()
The Singleton method.
|
int |
getNextID()
Get the next unique animal ID number and increment the counter.
|
int[] |
getSize() |
int |
getStartEnergyCarnivores() |
int |
getStartEnergyHerbivores() |
int |
getStartGrassDensity() |
int |
getStartNoCarnivores() |
int |
getStartNoHerbivores() |
int |
getStopAt() |
int |
getTimelapse() |
int |
getTurn() |
int |
getWaterTiles() |
void |
giveNews(java.lang.String message)
Display a news item - calling with null as a parameter resets the news list
|
void |
incGeneration(int n)
Increment the generation counter as necessary.
|
void |
incrementTurn()
Increment the turn variable by one.
|
boolean |
isRunning() |
void |
readConfigFile(java.lang.String filename)
Read and parse a config file.
|
void |
reset()
Reset the world run-time variables, ready for a new run.
|
void |
setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo) |
void |
setAutorun(int autorun) |
void |
setAverageGrassDensity(int averageGrassDensity) |
void |
setCarnivoreCount(int carnivoreCounter) |
void |
setDefaultGenome(OccupantType type,
int mutationRate,
int speed,
int stamina,
int sight,
int metabolism,
int ageLimit,
int strength,
int reproductiveEnergy,
int maturityAge,
int gestation,
int reproductionRate)
Interface for the Genome method
|
void |
setHerbivoreCount(int herbivoreCounter) |
void |
setHumidity(Humidity humidity) |
void |
setRunning(boolean running) |
void |
setSize(int[] size) |
void |
setStartEnergyCarnivores(int startEnergyCarnivores) |
void |
setStartEnergyHerbivores(int startEnergyHerbivores) |
void |
setStartGrassDensity(int startGrassDensity) |
void |
setStartNoCarnivores(int startNoCarnivores) |
void |
setStartNoHerbivores(int startNoHerbivores) |
void |
setStartNoWaterTiles(int startNoWaterTiles) |
void |
setStopAt(int stopAt) |
void |
setTimelapse(int timelapse) |
private static World world
private int[] size
private int timelapse
private int stopAt
private int autorun
private Humidity humidity
private int startGrassDensity
private int waterTiles
private int startNoCarnivores
private int startNoHerbivores
private int startEnergyCarnivores
private int startEnergyHerbivores
private boolean running
private int turn
private int nextID
private int herbivoreCounter
private int carnivoreCounter
private int highestGeneration
private int averageGrassDensity
private java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animals
private java.util.ArrayList<java.lang.String> news
private World()
public static World getInstance()
public void readConfigFile(java.lang.String filename)
public void reset()
public void giveNews(java.lang.String message)
news
- public java.util.HashMap<java.lang.String,java.lang.Integer> getAnimalInfo(int x, int y)
x,
- ypublic java.util.HashMap<java.lang.String,java.lang.Integer> getFieldInfo(int x, int y)
x,
- ypublic java.util.HashMap<java.lang.String,java.lang.Integer> getDefaultGenome(OccupantType type)
public void setDefaultGenome(OccupantType type, int mutationRate, int speed, int stamina, int sight, int metabolism, int ageLimit, int strength, int reproductiveEnergy, int maturityAge, int gestation, int reproductionRate)
public int[] getSize()
public void setSize(int[] size)
public int getTimelapse()
public void setTimelapse(int timelapse)
public int getStopAt()
public void setStopAt(int stopAt)
public int getAutorun()
public void setAutorun(int autorun)
public Humidity getHumidity()
public void setHumidity(Humidity humidity)
public int getStartGrassDensity()
public void setStartGrassDensity(int startGrassDensity)
public int getWaterTiles()
public void setStartNoWaterTiles(int startNoWaterTiles)
public int getStartNoCarnivores()
public void setStartNoCarnivores(int startNoCarnivores)
public int getStartNoHerbivores()
public void setStartNoHerbivores(int startNoHerbivores)
public int getStartEnergyCarnivores()
public void setStartEnergyCarnivores(int startEnergyCarnivores)
public int getStartEnergyHerbivores()
public void setStartEnergyHerbivores(int startEnergyHerbivores)
public int getHerbivoreCount()
public void setHerbivoreCount(int herbivoreCounter)
public int getCarnivoreCount()
public void setCarnivoreCount(int carnivoreCounter)
public int getAverageGrassDensity()
public void setAverageGrassDensity(int averageGrassDensity)
public boolean isRunning()
public void setRunning(boolean running)
public int getTurn()
public void incrementTurn()
public int getNextID()
public void incGeneration(int n)
public int getGeneration()
public void setAnimals(java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Integer>> animalInfo)
public java.util.ArrayList<java.lang.String> collectNews()