Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final java.lang.String |
+version |
+"1.1" |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final int |
+BREAK_ERROR |
+1 |
+
+
+public static final int |
+CONTINUABLE_ERROR |
+0 |
+
+
+public static final int |
+FATAL_ERROR |
+2 |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+private final int |
+DEFAULT_MUTATION_RATE |
+0 |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+private static final long |
+serialVersionUID |
+4727895060816956404L |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final java.lang.String |
+version |
+"1.1" |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final int |
+BREAK_ERROR |
+1 |
+
+
+public static final int |
+CONTINUABLE_ERROR |
+0 |
+
+
+public static final int |
+FATAL_ERROR |
+2 |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+private final int |
+DEFAULT_MUTATION_RATE |
+0 |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+private static final long |
+serialVersionUID |
+4727895060816956404L |
+
Enum Constant and Description | +
---|
DROUGHT |
+
DRY |
+
SATURATION |
+
SEVERE_DROUGHT |
+
WET |
+
Modifier and Type | +Method and Description | +
---|---|
static Humidity |
+fromString(java.lang.String value)
+Convert an integer into an enum entry
+ |
+
static Humidity |
+getStatus(int value)
+Convert a number into an enum entry.
+ |
+
java.lang.String |
+getString()
+Return the string representation of an entry.
+ |
+
int |
+getValue()
+Return the numerical value of an entry.
+ |
+
static Humidity |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static Humidity[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final Humidity SEVERE_DROUGHT+
public static final Humidity DROUGHT+
public static final Humidity DRY+
public static final Humidity WET+
public static final Humidity SATURATION+
public static Humidity[] values()+
+for (Humidity c : Humidity.values()) + System.out.println(c); +
public static Humidity valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic int getValue()+
public java.lang.String getString()+
public static Humidity fromString(java.lang.String value)+
public static Humidity getStatus(int value)+
int
- valueModifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final java.lang.String |
+version |
+"1.1" |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final int |
+BREAK_ERROR |
+1 |
+
+
+public static final int |
+CONTINUABLE_ERROR |
+0 |
+
+
+public static final int |
+FATAL_ERROR |
+2 |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+private final int |
+DEFAULT_MUTATION_RATE |
+0 |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+private static final long |
+serialVersionUID |
+4727895060816956404L |
+
Enum Constant and Description | +
---|
DROUGHT |
+
DRY |
+
SATURATION |
+
SEVERE_DROUGHT |
+
WET |
+
Modifier and Type | +Method and Description | +
---|---|
static Humidity |
+fromString(java.lang.String value)
+Convert an integer into an enum entry
+ |
+
static Humidity |
+getStatus(int value)
+Convert a number into an enum entry.
+ |
+
java.lang.String |
+getString()
+Return the string representation of an entry.
+ |
+
int |
+getValue()
+Return the numerical value of an entry.
+ |
+
static Humidity |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static Humidity[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final Humidity SEVERE_DROUGHT+
public static final Humidity DROUGHT+
public static final Humidity DRY+
public static final Humidity WET+
public static final Humidity SATURATION+
public static Humidity[] values()+
+for (Humidity c : Humidity.values()) + System.out.println(c); +
public static Humidity valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic int getValue()+
public java.lang.String getString()+
public static Humidity fromString(java.lang.String value)+
public static Humidity getStatus(int value)+
int
- valuepublic enum OccupantType +extends java.lang.Enum<OccupantType>+
Enum Constant and Description | +
---|
CARNIVORE |
+
HERBIVORE |
+
NONE |
+
WATER |
+
Modifier and Type | +Method and Description | +
---|---|
static OccupantType |
+fromInt(int i)
+Convert the corresponding enum entry for this integer
+ |
+
static OccupantType |
+fromString(java.lang.String s)
+Transform a string into an occupant type
+ |
+
int |
+toInt()
+Convert an enum entry to an integer
+ |
+
java.lang.String |
+toString()
+Return the string representation of an entry.
+ |
+
static OccupantType |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static OccupantType[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final OccupantType NONE+
public static final OccupantType HERBIVORE+
public static final OccupantType CARNIVORE+
public static final OccupantType WATER+
public static OccupantType[] values()+
+for (OccupantType c : OccupantType.values()) + System.out.println(c); +
public static OccupantType valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic int toInt()+
public static OccupantType fromInt(int i)+
public java.lang.String toString()+
toString
in class java.lang.Enum<OccupantType>
public static OccupantType fromString(java.lang.String s)+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final java.lang.String |
+version |
+"1.1" |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final int |
+BREAK_ERROR |
+1 |
+
+
+public static final int |
+CONTINUABLE_ERROR |
+0 |
+
+
+public static final int |
+FATAL_ERROR |
+2 |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+private final int |
+DEFAULT_MUTATION_RATE |
+0 |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+private static final long |
+serialVersionUID |
+4727895060816956404L |
+
Enum Constant and Description | +
---|
DROUGHT |
+
DRY |
+
SATURATION |
+
SEVERE_DROUGHT |
+
WET |
+
Modifier and Type | +Method and Description | +
---|---|
static Humidity |
+fromString(java.lang.String value)
+Convert an integer into an enum entry
+ |
+
static Humidity |
+getStatus(int value)
+Convert a number into an enum entry.
+ |
+
java.lang.String |
+getString()
+Return the string representation of an entry.
+ |
+
int |
+getValue()
+Return the numerical value of an entry.
+ |
+
static Humidity |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static Humidity[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final Humidity SEVERE_DROUGHT+
public static final Humidity DROUGHT+
public static final Humidity DRY+
public static final Humidity WET+
public static final Humidity SATURATION+
public static Humidity[] values()+
+for (Humidity c : Humidity.values()) + System.out.println(c); +
public static Humidity valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic int getValue()+
public java.lang.String getString()+
public static Humidity fromString(java.lang.String value)+
public static Humidity getStatus(int value)+
int
- valuepublic enum OccupantType +extends java.lang.Enum<OccupantType>+
Enum Constant and Description | +
---|
CARNIVORE |
+
HERBIVORE |
+
NONE |
+
WATER |
+
Modifier and Type | +Method and Description | +
---|---|
static OccupantType |
+fromInt(int i)
+Convert the corresponding enum entry for this integer
+ |
+
static OccupantType |
+fromString(java.lang.String s)
+Transform a string into an occupant type
+ |
+
int |
+toInt()
+Convert an enum entry to an integer
+ |
+
java.lang.String |
+toString()
+Return the string representation of an entry.
+ |
+
static OccupantType |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static OccupantType[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final OccupantType NONE+
public static final OccupantType HERBIVORE+
public static final OccupantType CARNIVORE+
public static final OccupantType WATER+
public static OccupantType[] values()+
+for (OccupantType c : OccupantType.values()) + System.out.println(c); +
public static OccupantType valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic int toInt()+
public static OccupantType fromInt(int i)+
public java.lang.String toString()+
toString
in class java.lang.Enum<OccupantType>
public static OccupantType fromString(java.lang.String s)+
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) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
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()+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final java.lang.String |
+version |
+"1.1" |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final int |
+BREAK_ERROR |
+1 |
+
+
+public static final int |
+CONTINUABLE_ERROR |
+0 |
+
+
+public static final int |
+FATAL_ERROR |
+2 |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+private final int |
+DEFAULT_MUTATION_RATE |
+0 |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+private static final long |
+serialVersionUID |
+4727895060816956404L |
+
Enum Constant and Description | +
---|
DROUGHT |
+
DRY |
+
SATURATION |
+
SEVERE_DROUGHT |
+
WET |
+
Modifier and Type | +Method and Description | +
---|---|
static Humidity |
+fromString(java.lang.String value)
+Convert an integer into an enum entry
+ |
+
static Humidity |
+getStatus(int value)
+Convert a number into an enum entry.
+ |
+
java.lang.String |
+getString()
+Return the string representation of an entry.
+ |
+
int |
+getValue()
+Return the numerical value of an entry.
+ |
+
static Humidity |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static Humidity[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final Humidity SEVERE_DROUGHT+
public static final Humidity DROUGHT+
public static final Humidity DRY+
public static final Humidity WET+
public static final Humidity SATURATION+
public static Humidity[] values()+
+for (Humidity c : Humidity.values()) + System.out.println(c); +
public static Humidity valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic int getValue()+
public java.lang.String getString()+
public static Humidity fromString(java.lang.String value)+
public static Humidity getStatus(int value)+
int
- valuepublic enum OccupantType +extends java.lang.Enum<OccupantType>+
Enum Constant and Description | +
---|
CARNIVORE |
+
HERBIVORE |
+
NONE |
+
WATER |
+
Modifier and Type | +Method and Description | +
---|---|
static OccupantType |
+fromInt(int i)
+Convert the corresponding enum entry for this integer
+ |
+
static OccupantType |
+fromString(java.lang.String s)
+Transform a string into an occupant type
+ |
+
int |
+toInt()
+Convert an enum entry to an integer
+ |
+
java.lang.String |
+toString()
+Return the string representation of an entry.
+ |
+
static OccupantType |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static OccupantType[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final OccupantType NONE+
public static final OccupantType HERBIVORE+
public static final OccupantType CARNIVORE+
public static final OccupantType WATER+
public static OccupantType[] values()+
+for (OccupantType c : OccupantType.values()) + System.out.println(c); +
public static OccupantType valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic int toInt()+
public static OccupantType fromInt(int i)+
public java.lang.String toString()+
toString
in class java.lang.Enum<OccupantType>
public static OccupantType fromString(java.lang.String s)+
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) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
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()+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final java.lang.String |
+version |
+"1.1" |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final int |
+BREAK_ERROR |
+1 |
+
+
+public static final int |
+CONTINUABLE_ERROR |
+0 |
+
+
+public static final int |
+FATAL_ERROR |
+2 |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+private final int |
+DEFAULT_MUTATION_RATE |
+0 |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+private static final long |
+serialVersionUID |
+4727895060816956404L |
+
Enum Constant and Description | +
---|
DROUGHT |
+
DRY |
+
SATURATION |
+
SEVERE_DROUGHT |
+
WET |
+
Modifier and Type | +Method and Description | +
---|---|
static Humidity |
+fromString(java.lang.String value)
+Convert an integer into an enum entry
+ |
+
static Humidity |
+getStatus(int value)
+Convert a number into an enum entry.
+ |
+
java.lang.String |
+getString()
+Return the string representation of an entry.
+ |
+
int |
+getValue()
+Return the numerical value of an entry.
+ |
+
static Humidity |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static Humidity[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final Humidity SEVERE_DROUGHT+
public static final Humidity DROUGHT+
public static final Humidity DRY+
public static final Humidity WET+
public static final Humidity SATURATION+
public static Humidity[] values()+
+for (Humidity c : Humidity.values()) + System.out.println(c); +
public static Humidity valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic int getValue()+
public java.lang.String getString()+
public static Humidity fromString(java.lang.String value)+
public static Humidity getStatus(int value)+
int
- valuepublic enum OccupantType +extends java.lang.Enum<OccupantType>+
Enum Constant and Description | +
---|
CARNIVORE |
+
HERBIVORE |
+
NONE |
+
WATER |
+
Modifier and Type | +Method and Description | +
---|---|
static OccupantType |
+fromInt(int i)
+Convert the corresponding enum entry for this integer
+ |
+
static OccupantType |
+fromString(java.lang.String s)
+Transform a string into an occupant type
+ |
+
int |
+toInt()
+Convert an enum entry to an integer
+ |
+
java.lang.String |
+toString()
+Return the string representation of an entry.
+ |
+
static OccupantType |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static OccupantType[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final OccupantType NONE+
public static final OccupantType HERBIVORE+
public static final OccupantType CARNIVORE+
public static final OccupantType WATER+
public static OccupantType[] values()+
+for (OccupantType c : OccupantType.values()) + System.out.println(c); +
public static OccupantType valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic int toInt()+
public static OccupantType fromInt(int i)+
public java.lang.String toString()+
toString
in class java.lang.Enum<OccupantType>
public static OccupantType fromString(java.lang.String s)+
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) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
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()+
See: Description
+Class | +Description | +
---|---|
World | +
+ The World class acts as a communicator between the model and the view packages.
+ |
+
Enum | +Description | +
---|---|
Humidity | +
+ The different levels of humidity that are available.
+ |
+
OccupantType | +
+ This is a list of all the possible elements that can occupy a field.
+ |
+